"""Training list for the Japanese VITS from JSUT 1.1 (one female speaker, 48 kHz, 7,696 utterances, 10.3 h): all nine subsets, transcripts converted to katakana with vits/kana.py, clips over 15 s dropped (the Open Bible VITS data were capped at 15 s by F5-TTS prepare_data.py), and utterances with characters pyopenjtalk could not read dropped. Writes, in the open-bible-models format (pipe-separated, header, absolute paths to the original 48 kHz wavs; train_Japanese.sh resamples them to 22,050 Hz): data/JSUT-VITS/metadata.csv audio_file|text|speaker_id, the training list data/JSUT-VITS/transcripts.csv every utterance: subset, id, duration, original text, kana, kept / why not, for review None of the 34 Japanese listening-test sentences occurs in JSUT (checked 2026-12-01). JSUT audio is for research and non-commercial use and may not be redistributed: data/jsut_ver1.1 and data/JSUT-VITS stay out of git. Env: CoquiTTS (pyopenjtalk 0.4.1, see vits/README.md). python vits/prepare_jsut.py """ import argparse, collections, glob, os, sys, unicodedata import pandas as pd, soundfile as sf sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))); from kana import convert # noqa: E402 REPO = "/network/scratch/g/guzmand/Repositories/Multilingual-MOS" SPEAKER = "SPEAKER_00_Japanese" # train_vits.py keeps a speaker table; Open Bible ids are SPEAKER__ def main(): ap = argparse.ArgumentParser(description=__doc__.split("\n")[0]) ap.add_argument("--jsut", default=f"{REPO}/data/jsut_ver1.1", help="unzipped JSUT 1.1") ap.add_argument("--out", default=f"{REPO}/data/JSUT-VITS") ap.add_argument("--max-s", type=float, default=15.0, help="drop clips longer than this (seconds)") a = ap.parse_args() rows = [] for f in sorted(glob.glob(f"{a.jsut}/*/transcript_utf8.txt")): subset = os.path.basename(os.path.dirname(f)) for line in open(f, encoding="utf-8"): if ":" not in line: continue uid, text = line.rstrip("\n").split(":", 1) wav = os.path.abspath(f"{a.jsut}/{subset}/wav/{uid}.wav") kana, unconverted = convert(text); dur = sf.info(wav).duration why = [f"longer than {a.max_s:g} s"] if dur > a.max_s else [] why += [f"unconverted: {''.join(unconverted)}"] if unconverted else [] why += ["no kana"] if not any(unicodedata.category(c)[0] == "L" for c in kana) else [] rows.append(dict(subset=subset, uid=uid, audio_file=wav, duration_s=round(dur, 2), text=text, kana=kana, kept=not why, why="; ".join(why))) if not rows: sys.exit(f"no transcripts under {a.jsut}: unzip data/jsut_ver1.1.zip first") df = pd.DataFrame(rows) assert df.audio_file.map(os.path.basename).is_unique, "preprocess_open_bible_audio.py writes all wavs into one folder by file name" assert not df.kana.str.contains(r'[|"]').any(), "the open-bible formatter splits lines on | without quoting" os.makedirs(a.out, exist_ok=True) df.to_csv(f"{a.out}/transcripts.csv", index=False) keep = df[df.kept] with open(f"{a.out}/metadata.csv", "w", encoding="utf-8") as fh: fh.write("audio_file|text|speaker_id\n") fh.writelines(f"{r.audio_file}|{r.kana}|{SPEAKER}\n" for r in keep.itertuples()) # the vocabulary train_vits.py will build: letters and marks of the lowercased text (punctuation is configured separately) vocab = collections.Counter(c for t in keep.kana for c in t.lower() if unicodedata.category(c)[0] in "LM") print(f"kept {len(keep)} of {len(df)} utterances, {keep.duration_s.sum() / 3600:.2f} h (dropped: " f"{df[~df.kept].why.str.replace(r':.*', '', regex=True).value_counts().to_dict()})") print(keep.groupby("subset").agg(utts=("uid", "size"), hours=("duration_s", lambda d: round(d.sum() / 3600, 2))).to_string()) print(f"vocabulary: {len(vocab)} symbols, rarest {min(vocab.values())}x: {''.join(sorted(vocab))}") print(f"-> {a.out}/metadata.csv, {a.out}/transcripts.csv") if __name__ == "__main__": main()