How to generate single audio file for longer texts.
#87
by
AgarVaibhav
- opened
In this version seperate audio files are being created as the code is written, but is there any other way through which i can a single audio file for longer text?
Yeah it wouldn't be that hard, I made this for XTTS:
def concatenate_wav_files(self, output_files):
# Vine each grape into bunch upon completion
combined_audio = AudioSegment.empty()
for file in output_files:
#file = resemble_enchance_audio(file, True)
audio_segment = AudioSegment.from_wav(file)
combined_audio += audio_segment
os.remove(file) # Currently not working(?) in original venv
# Save the combined audio file
output_dir = Path.cwd() / "tts_outputs"
output_dir.mkdir(exist_ok=True)
save_path, _ = QFileDialog.getSaveFileName(self, "Save Audio File", str(output_dir), "Wave Files (*.wav)")
if save_path:
combined_audio.export(save_path, format="wav")
print(f"Combined audio saved to: {save_path}")
I'm sure something already exists for this, if not I'll send you whatever I come up with.