fix: dont use blank text splits

pull/880/head
Callum Leslie 2 years ago
parent 2f5d394bba
commit c5c64a5e4b
No known key found for this signature in database
GPG Key ID: D382C4AFEECEAA90

@ -85,15 +85,16 @@ class TTSEngine:
r" *(((.|\n){0," + str(self.tts_module.max_chars) + "})(\.|.$))", text
)
]
offset = 0
for idy, text_cut in enumerate(split_text):
# print(f"{idx}-{idy}: {text_cut}\n")
if text_cut == "":
print("Empty text cut: tell the devs about this")
if not text_cut or text_cut.isspace():
offset += 1
continue
self.call_tts(f"{idx}-{idy}.part", text_cut)
split_files.append(AudioFileClip(f"{self.path}/{idx}-{idy}.part.mp3"))
self.call_tts(f"{idx}-{idy - offset}.part", text_cut)
split_files.append(AudioFileClip(f"{self.path}/{idx}-{idy - offset}.part.mp3"))
CompositeAudioClip([concatenate_audioclips(split_files)]).write_audiofile(
f"{self.path}/{idx}.mp3", fps=44100, verbose=False, logger=None
)

Loading…
Cancel
Save