Update Uptated-Prototype/TTS-Script-PiperTTS.py
This commit is contained in:
@@ -4,6 +4,12 @@ import pyaudio
|
||||
import subprocess
|
||||
import os
|
||||
import time
|
||||
import keyboard
|
||||
|
||||
def pause():
|
||||
while True:
|
||||
if keyboard.read_key() == 'space':
|
||||
break
|
||||
|
||||
result = subprocess.run(["xsel"], capture_output=True, text=True) # In Theory grab selected text into Varible called TextToSpeak
|
||||
time.sleep(1)
|
||||
@@ -35,7 +41,7 @@ stream.write(first_chunk.audio_int16_bytes) # Play the first chunk
|
||||
|
||||
for chunk in chunks: # Play subsequent chunks of audio
|
||||
stream.write(chunk.audio_int16_bytes)
|
||||
time.sleep(2)
|
||||
pause()
|
||||
|
||||
# Cleanup
|
||||
stream.stop_stream()
|
||||
|
||||
Reference in New Issue
Block a user