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