Small Commit

This commit is contained in:
2026-01-18 02:55:04 +01:00
parent 9c5a87e61d
commit 06954aeef0
5 changed files with 787 additions and 0 deletions

27
test_tts.py Normal file
View File

@@ -0,0 +1,27 @@
import subprocess
PIPER_BIN = "piper"
PIPER_MODEL = "de_DE-thorsten-medium.onnx"
SAMPLE_RATE = 22050 #aplay -v assistant/audio-tts/predefined.wav so rausgefunden
def speak(text):
print(f"[TTS] {text}")
process = subprocess.Popen(
[PIPER_BIN, "--model", PIPER_MODEL, "--output-raw"],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE
)
audio = process.communicate(input=text.encode("utf-8"))[0]
play = subprocess.Popen(
["aplay", "-r", str(SAMPLE_RATE), "-f", "S16_LE"],
stdin=subprocess.PIPE
)
play.communicate(audio)
text="Das Auto musste repariert werden, bevor wir weiterfahren konnten, neuer text"
speak(text)