rhasspy / rhasspy-microphone-pyaudio-hermes

MQTT service for audio input from PyAudio using Hermes protocol
MIT License
6 stars 4 forks source link

pyaudio stops working #2

Closed fherbet closed 3 years ago

fherbet commented 4 years ago

Hi,

just installed and testing this wonderful project! i built it using Rpi4 4G + docker rhasspy:latest (2.5)+PS3 eye

encountered an issue where rhasppy stops listening after a few mns ..only way to recover is to click restart...

here are the logs i get when it gets stuck

[ERROR:2020-06-07 18:08:04,161] rhasspymicrophone_pyaudio_hermes: record Traceback (most recent call last): File "/usr/lib/rhasspy/lib/python3.7/site-packages/rhasspymicrophone_pyaudio_hermes/init.py", line 121, in record chunk = mic.read(self.frames_per_buffer) File "/usr/lib/rhasspy/lib/python3.7/site-packages/pyaudio.py", line 608, in read return pa.read_stream(self._stream, num_frames, exception_on_overflow) OSError: [Errno -9981] Input overflowed

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/rhasspy/lib/python3.7/site-packages/rhasspymicrophone_pyaudio_hermes/init.py", line 128, in record mic.stop_stream() File "/usr/lib/rhasspy/lib/python3.7/site-packages/pyaudio.py", line 524, in stop_stream pa.stop_stream(self._stream) OSError: Stream not open [DEBUG:2020-06-07 18:08:04,166] rhasspymicrophone_pyaudio_hermes: -> AudioRecordError(error='Stream not open', site_id='salon', context='Device index: 2', session_id=None) [DEBUG:2020-06-07 18:08:04,166] rhasspymicrophone_pyaudio_hermes: Publishing 96 bytes(s) to hermes/error/audioServer/record

my profile.json contains

{ "dialogue": { "system": "rhasspy" }, "handle": { "remote": { "url": "https://192.168.1.46/core/api/jeeApi.php?plugin=jeerhasspy&apikey=xxxxxxxxxxxxxxxxxxxxxxxxxxxxx&plugin=jeerhasspy&type=jeerhasspy" }, "system": "remote" }, "intent": { "system": "fsticuffs" }, "microphone": { "pyaudio": { "device": "2" }, "system": "pyaudio" }, "mqtt": { "site_id": "salon" }, "sounds": { "aplay": { "device": "default:CARD=ALSA" }, "system": "aplay" }, "speech_to_text": { "system": "pocketsphinx" }, "text_to_speech": { "espeak": { "voice": "fr-fr" }, "system": "picotts" }, "wake": { "porcupine": { "keyword_path": "blueberry.ppn", "sensitivity": "0.9" }, "snowboy": { "model": "jarvis.pmdl", "sensitivity": "0.5" }, "system": "snowboy" }, "webhooks": { "awake": [ "https://192.168.1.46/core/api/jeeApi.php?plugin=jeerhasspy&apikey=xxxxxxxxxxxx&plugin=jeerhasspy&type=jeerhasspy" ] } }

fherbet commented 4 years ago

Works fine with arecor ...

DavidCarpus commented 4 years ago

In my case I am running this in docker on a raspi 4 with a Play Station Eye Camera for PS3. (which works fairly well for this) I am not really a Python developer but thought I would search around a bit and see if I could find any 'pointers'. This thread seemed to point to a couple promising solutions that might be worth looking at. IF I can get some time to setup a dev environment for Python and a little up to speed on the language I might try to take a stab at it. (Unfortunately, I am not hopeful of finding spare time this year) I also notice it happens primarily if/when there is background noise when using the system.

synesthesiam commented 3 years ago

I've reworked the PyAudio API usage in 8d0af4d25c6f1036d65017700c115a22ed80deea

With the next update to Rhasspy (2.5.9), I'm hoping this issue will be fixed.

synesthesiam commented 3 years ago

Please re-open if there's still a problem.