From a3d45874ac48de1ce2054826134f675c63e7a0a5 Mon Sep 17 00:00:00 2001 From: Yatharth Sharma Date: Sun, 25 Jan 2026 11:08:17 -0500 Subject: [PATCH] Add audio saving to speech generation in README Added audio saving functionality to the speech generation examples. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 4fd74c2..5a14d90 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,7 @@ lux_tts = LuxTTS('YatharthS/LuxTTS', device='cuda', threads=2) ## change device #### Simple inference ```python +import soundfile as sf from IPython.display import Audio text = "Hey, what's up? I'm feeling really great if you ask me honestly!" @@ -58,12 +59,17 @@ encoded_prompt = lux_tts.encode_prompt(prompt_audio, rms=0.01) ## generate speech final_wav = lux_tts.generate_speech(text, encoded_prompt, num_steps=num_steps) +## save audio +final_wav = final_wav.numpy().squeeze() +sf.write('output.wav', audio_data, 48000) + ## display speech display(Audio(final_wav, rate=48000)) ``` #### Inference with sampling params: ```python +import soundfile as sf from IPython.display import Audio text = "Hey, what's up? I'm feeling really great if you ask me honestly!" @@ -83,6 +89,10 @@ encoded_prompt = lux_tts.encode_prompt(prompt_audio, rms=rms) ## generate speech final_wav = lux_tts.generate_speech(text, encoded_prompt, num_steps=num_steps, t_shift=t_shift, speed=speed, return_smooth=return_smooth) +## save audio +final_wav = final_wav.numpy().squeeze() +sf.write('output.wav', audio_data, 48000) + ## display speech display(Audio(final_wav, rate=48000)) ```