Sort of working

This commit is contained in:
David Rice
2026-04-18 12:52:59 +01:00
parent 1f19834906
commit 7529f81ffe
3 changed files with 507 additions and 1 deletions

View File

@@ -259,8 +259,21 @@ def _lerp_color(c1: tuple, c2: tuple, t: float) -> tuple:
return tuple(int(c1[i] + (c2[i] - c1[i]) * t) for i in range(3))
_PIPER_MODEL = '/home/dfr84/Python/JARVIS/en_GB-alan-medium.onnx'
def _speak(text: str) -> None:
subprocess.run(['espeak-ng', '-s', '150', text], capture_output=True)
piper = subprocess.Popen(
['piper', '--model', _PIPER_MODEL, '--output_raw'],
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.DEVNULL,
)
raw, _ = piper.communicate(input=text.encode())
subprocess.run(
['aplay', '-r', '22050', '-f', 'S16_LE', '-t', 'raw', '-'],
input=raw,
capture_output=True,
)
def _handle_command(raw: bytes, n_ch: int, native_hz: int) -> None: