Skip to content

Commit

Permalink
update formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
manmay-nakhashi committed Jul 27, 2023
1 parent 7ba5e30 commit 4ab6a69
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions TTS/tts/datasets/formatters.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,24 +280,26 @@ def common_voice(root_path, meta_file, ignored_speakers=None):
)
return items

def libri_r(root_path, meta_files=None, wavs_path="wav48", ignored_speakers=None):
def libri_r(root_path, meta_files=None, wavs_path="wav24", ignored_speakers=None):
"""homepages.inf.ed.ac.uk/jyamagis/release/VCTK-Corpus.tar.gz"""
items = []
meta_files = glob(f"{root_path}/**/*.normalized.txt", recursive=True)
for meta_file in meta_files[:1000]:
_, folder_id, speaker_id, txt_file = os.path.relpath(meta_file, root_path).split(os.sep)
for meta_file in meta_files:
folder_id, speaker_id, txt_file = os.path.relpath(meta_file, root_path).split(os.sep)
file_id = txt_file.split(".")[0]
# ignore speakers
if isinstance(ignored_speakers, list):
if speaker_id in ignored_speakers:
continue
with open(meta_file, "r", encoding="utf-8") as file_text:
text = file_text.readlines()[0]
wav_file = os.path.join(root_path, wavs_path, folder_id, speaker_id, file_id + ".wav")
print("text", text, "audio_file", wav_file, "speaker_name", "VCTK_old_" + speaker_id, "root_path", root_path)
items.append(
{"text": text, "audio_file": wav_file, "speaker_name": speaker_id, "root_path": root_path}
)
wav_file = os.path.join(root_path, folder_id, speaker_id, file_id + ".wav")
if os.path.exists(wav_file):
items.append(
{"text": text, "audio_file": wav_file, "speaker_name": speaker_id, "root_path": root_path}
)
else:
print("missing file: ", wav_file)
return items

def libri_tts(root_path, meta_files=None, ignored_speakers=None):
Expand Down

0 comments on commit 4ab6a69

Please sign in to comment.