Mic Not Recording Using arecord or PyAudio on RPi 4 w/ Docker

Hello. I have a new Raspberry Pi 4, 64 Bit that I am running the Docker version of Rhasspy on. After much work getting both arecord and PyAudio to work outside of the app, I do have them both recording audio from a USB mic using Terminal. I’ve seen many different posts with similar situations, but not this specific. I the Rhasspy web interface, I am having issues with both options.

Using arecord, the USB mic is recognized via the “test” functionality in the Audio Recording config, but does not trigger any activity after using the “Wake Word” button. These are the logs when using the wake word button:

[ERROR:2024-02-20 08:21:22,053] rhasspyserver_hermes: 
Traceback (most recent call last):
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1821, in full_dispatch_request
    result = await self.dispatch_request(request_context)
  File "/usr/lib/rhasspy/.venv/lib/python3.7/site-packages/quart/app.py", line 1869, in dispatch_request
    return await handler(**request_.view_args)
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__main__.py", line 943, in api_listen_for_command
    async for response in core.publish_wait(handle_intent(), [], message_types):
  File "/usr/lib/rhasspy/rhasspy-server-hermes/rhasspyserver_hermes/__init__.py", line 995, in publish_wait
    result_awaitable, timeout=timeout_seconds
  File "/usr/lib/python3.7/asyncio/tasks.py", line 423, in wait_for
    raise futures.TimeoutError()

Using PyAudio on the other hand, doesn’t even recognize the USB mic in the Audio Recording config. Clicking the “test” button shows the overlay for a split second, but then it immediately closes without triggering the “working” state for the mic (which is on hw:4,0). The follow logs are generated:

[DEBUG:2024-02-20 08:35:00,020] rhasspyserver_hermes: Handling AudioDevices (topic=rhasspy/audioServer/devices, id=88c68385-e33c-49e7-af68-d478d2a550f2)
[DEBUG:2024-02-20 08:34:59,956] rhasspyserver_hermes: Publishing 101 bytes(s) to rhasspy/audioServer/getDevices
[DEBUG:2024-02-20 08:34:59,955] rhasspyserver_hermes: -> AudioGetDevices(modes=[<AudioDeviceMode.INPUT: 'input'>], site_id='default', id='59e30a4d-d22a-46e9-afed-39c5244695a4', test=True)

I’ve been struggling with this for weeks now. Any help would greatly appreciated! Thank you.

Sadly I’ve had a very similar issue. Not finding anything that will work on the forums or GH issues. In my case, using arecord from the CLI directly DOES record audio, even using the same command that the docs say Rhasspy is using.

It’s unfortunate that there haven’t been any responses or suggestions on this forum. If you happen to find a solution, please let me know. I’ve been blocked from doing anything else with Rhasspy due to this.

Hi polyworks,
Can’t offer much help on your issue other than taking a look at the ALSA config, and making sure the USB microphone is the default. That worked for me, but I’d suggest doing a full install of Rhasspy rather than using Docker. Now, I love Docker, but sound in linux is tough enough (at least for me) without adding Docker into the mix. I went the native route because I got really lucky and got a really cool USB microphone, but is only works at 44,100, which didn’t play nice with Rhasspy, but I was able to get it working under the full install (and it works really well, I can be down the hall in another room and the wake word fires, and the intent is recognized). I realize that this isn’t any real help, but I did want to put it out there.

Hi @JeffC. That is actually helpful. Thank you. I’m new to all of this, so forgive the ignorance. Can you tell me how to find the ALSA config? Also, I’ll look into doing a full install Rhasspy. I’ve had so many problems with Python package versions and RaspberryPi projects reference packages that are no longer present or supported. I’d hoped that the Docker install would just work. BTW, which USB mic are you using? I have a ReSpeaker USB Mic Array.