mirror of https://github.com/MycroftAI/mimic2.git
Added check for wav file existence
parent
34e8126763
commit
0a37404582
|
@ -31,10 +31,14 @@ def main():
|
|||
metadata = open(os.path.join(dir_base_ljspeech,"metadata.csv"),mode="w", encoding="utf8")
|
||||
|
||||
for row in c.execute('SELECT audio_id, prompt, lower(prompt) FROM audiomodel ORDER BY length(prompt)'):
|
||||
metadata.write(row[0] + "|" + row[1] + "|" + row[2] + "\n")
|
||||
audio_file_source = os.path.join(dir_base_mrs,"backend","audio_files", uid, row[0] + ".wav")
|
||||
audio_file_dest = os.path.join(dir_base_ljspeech_wav,row[0] + ".wav")
|
||||
copyfile(audio_file_source,audio_file_dest)
|
||||
if os.path.isfile(audio_file_source):
|
||||
metadata.write(row[0] + "|" + row[1] + "|" + row[2] + "\n")
|
||||
audio_file_dest = os.path.join(dir_base_ljspeech_wav,row[0] + ".wav")
|
||||
copyfile(audio_file_source,audio_file_dest)
|
||||
else:
|
||||
print("File " + audio_file_source + " no found. Skipping.")
|
||||
|
||||
|
||||
metadata.close()
|
||||
conn.close()
|
||||
|
|
|
@ -44,9 +44,12 @@ def build_from_path(in_dir, out_dir, num_workers=1, tqdm=lambda x: x):
|
|||
|
||||
for row in c.execute('SELECT audio_id, lower(prompt) FROM audiomodel ORDER BY length(prompt)'):
|
||||
wav_path = os.path.join(wav_dir, '%s.wav' % row[0])
|
||||
text = row[1]
|
||||
futures.append(executor.submit(partial(_process_utterance, out_dir, index, wav_path, text)))
|
||||
index += 1
|
||||
if os.path.isfile(wav_path):
|
||||
text = row[1]
|
||||
futures.append(executor.submit(partial(_process_utterance, out_dir, index, wav_path, text)))
|
||||
index += 1
|
||||
else:
|
||||
print("File " + wav_path + " no found. Skipping.")
|
||||
return [future.result() for future in tqdm(futures)]
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue