diff --git a/Uptated-Prototype/TTS-Script-PiperTTS.py b/Uptated-Prototype/TTS-Script-PiperTTS.py index 684493c..7375f14 100644 --- a/Uptated-Prototype/TTS-Script-PiperTTS.py +++ b/Uptated-Prototype/TTS-Script-PiperTTS.py @@ -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()