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

This commit is contained in:
2025-12-03 12:53:11 -08:00
parent 83dc5c04c1
commit ab113c6396

View File

@@ -29,8 +29,14 @@ syn_config = SynthesisConfig(
) )
chunks = voice.synthesize(texttospeak, syn_config=syn_config) # Set up Piper to stream audio from TextToSpeak chunks = voice.synthesize(texttospeak, syn_config=syn_config) # Set up Piper to stream audio from TextToSpeak
print(f"There are {len(chunks)} Chunks.") # Print the amount of chunks
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
try:
print(first_chunk.sample_rate)
except:
print("Failed getting sample rate?")
p = pyaudio.PyAudio() p = pyaudio.PyAudio()
stream = p.open( # Open audio stream with correct settings stream = p.open( # Open audio stream with correct settings
format=p.get_format_from_width(first_chunk.sample_width), format=p.get_format_from_width(first_chunk.sample_width),