Update Uptated-Prototype/TTS-Script-PiperTTS 2nd.py

This commit is contained in:
2025-12-03 08:34:31 -08:00
parent 757bd7538e
commit 1ec9200bfc

View File

@@ -19,7 +19,15 @@ voicedir = os.path.expanduser('~') #Where onnx model files are stored on my mach
model = voicedir+"/en_GB-alba-medium.onnx" model = voicedir+"/en_GB-alba-medium.onnx"
voice = PiperVoice.load(model) voice = PiperVoice.load(model)
chunks = voice.synthesize(texttospeak) # Set up Piper to stream audio from TextToSpeak syn_config = SynthesisConfig(
volume=0.5, # half as loud
length_scale=2.0, # twice as slow
noise_scale=0.0, # more audio variation
noise_w_scale=0.0, # more speaking variation
normalize_audio=False, # use raw audio from voice
)
chunks = voice.synthesize(texttospeak, syn_config=syn_config) # Set up Piper to stream audio from TextToSpeak
first_chunk = next(chunks) # Get the first chunk to set up audio stream configuration first_chunk = next(chunks) # Get the first chunk to set up audio stream configuration
p = pyaudio.PyAudio() p = pyaudio.PyAudio()