From 93b7a5343233f844047298f0368ef63df6626d28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Paluch?= Date: Tue, 20 Oct 2026 17:22:13 +0200 Subject: [PATCH] =?UTF-8?q?Naprawa=20STT:=20pw-record=20zamiast=20parecord?= =?UTF-8?q?=20+=20SIGINT=20do=20poprawnego=20domkni=C4=99cia=20WAV?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PythonPlugins/PI_XSayATC.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/PythonPlugins/PI_XSayATC.py b/PythonPlugins/PI_XSayATC.py index ace8691..82e52eb 100644 --- a/PythonPlugins/PI_XSayATC.py +++ b/PythonPlugins/PI_XSayATC.py @@ -65,7 +65,7 @@ DEFAULT_CONFIG = { "whisper_cli": "/usr/bin/whisper-cli", "whisper_model": "/home/pali112/models/ggml-small.bin", "whisper_language": "auto", - "record_cmd": ["parecord", "--format=s16le", "--rate=16000", "--channels=1"], + "record_cmd": ["pw-record", "--format=s16", "--rate=16000", "--channels=1"], "piper": "/opt/piper-tts/piper", "piper_model": "/home/pali112/.local/share/piper-voices/en_US-lessac-medium.onnx", "play_cmd": ["aplay", "-q"], @@ -558,7 +558,7 @@ class XSayATC: return import tempfile self._record_file = tempfile.mktemp(suffix=".wav", prefix="xsayatc_") - cmd = list(self.config.get("record_cmd", ["parecord", "--format=s16le", "--rate=16000", "--channels=1"])) + cmd = list(self.config.get("record_cmd", ["pw-record", "--format=s16", "--rate=16000", "--channels=1"])) cmd.append(self._record_file) try: self._record_proc = subprocess.Popen(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) @@ -575,11 +575,13 @@ class XSayATC: self._recording = False if self._record_proc is not None: try: - self._record_proc.terminate() + # SIGINT kaze pw-record poprawnie domknac plik WAV + self._record_proc.send_signal(2) # 2 = SIGINT try: self._record_proc.wait(timeout=3) except Exception: self._record_proc.kill() + self._record_proc.wait(timeout=2) except Exception: pass self._record_proc = None