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

This commit is contained in:
2025-11-16 12:45:04 -08:00
parent 08ed016b17
commit 0a8b35c3ca

View File

@@ -1,12 +1,11 @@
# Theoretical Upgrade Test # Theoretical Upgrade Test
from piper.voice import PiperVoice # Backbone of text to speech from piper.voice import PiperVoice # Backbone of text to speech
import pyaudio import pyaudio
import subprocess
import os import os
import subprocess
import time import time
result = subprocess.run(["xsel"], capture_output=True, text=True) # In Theory grab selected text into Varible called TextToSpeak result = subprocess.run(["xsel"], capture_output=True, text=True) # In Theory grab selected text into Varible called TextToSpeak
time.sleep(1)
#print(result) # In Theory grab selected text and print ot to terminal #print(result) # In Theory grab selected text and print ot to terminal
texttospeak = str(result.stdout) texttospeak = str(result.stdout)
@@ -35,7 +34,6 @@ stream.write(first_chunk.audio_int16_bytes) # Play the first chunk
for chunk in chunks: # Play subsequent chunks of audio for chunk in chunks: # Play subsequent chunks of audio
stream.write(chunk.audio_int16_bytes) stream.write(chunk.audio_int16_bytes)
input()
# Cleanup # Cleanup
stream.stop_stream() stream.stop_stream()