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

This commit is contained in:
2025-11-08 15:49:53 -08:00
parent e41d037ec5
commit 58e2deacce

View File

@@ -4,11 +4,11 @@ import pyaudio
import os import os
# print(os.popen('xsel').read()) # In Theory grab selected text and print ot to terminal # print(os.popen('xsel').read()) # In Theory grab selected text and print ot to terminal
TextToSpeak = "Hello This is a Test!" #os.popen('xsel').read() # In Theory grab selected text into Varible cakked TextToSpeak texttospeak = "Hello This is a Test!" #os.popen('xsel').read() # In Theory grab selected text into Varible cakked TextToSpeak
voice = PiperVoice.load("~/en_US-amy-medium.onnx") # Load the model voice = PiperVoice.load("~/en_US-amy-medium.onnx") # Load the model
chunks = voice.synthesize(TextToSpeak) # Set up Piper to stream audio from TextToSpeak chunks = voice.synthesize(texttospeak) # 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()