Update Uptated-Prototype/TTS-Script-PiperTTS 2nd.py
This commit is contained in:
@@ -18,8 +18,16 @@ print(texttospeak)
|
|||||||
voicedir = os.path.expanduser('~') #Where onnx model files are stored on my machine
|
voicedir = os.path.expanduser('~') #Where onnx model files are stored on my machine
|
||||||
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()
|
||||||
Reference in New Issue
Block a user