synesthesiam / rhasspy

Rhasspy voice assistant for offline home automation
https://rhasspy.readthedocs.io
MIT License
942 stars 101 forks source link

arecord: main:788: audio open error: Device or resource busy #172

Closed basnijholt closed 4 years ago

basnijholt commented 4 years ago

I am trying to get Rhasspy working on Hass.io, Raspberry Pi 4, and PS Eye.

After the discussion on the forum we can now add a asound.conf in the UI.

I use this config because that person has the exact same setup as I do.

My microphone volume is too low, so (I believe) I need to use asound such that I can configure the microphone's volume.

PyAudio only works when I practically scream, however, I cannot get the ALSA option to work.

I selected it like image But now when I try to record something by clicking on the "Hold to Record" button: image

Nothing is ever detected.

So I tried recording something using the terminal. I did:

export DOCKER=`sudo docker container ls | grep rhasspy | awk '{print $1}'`
sudo docker exec $DOCKER arecord -d 5 -r 16000 /tmp/test.wav
sudo docker cp $DOCKER:/tmp/test.wav .
# sudo docker exec $DOCKER aplay /tmp/test.wav

and then I get

arecord: main:788: audio open error: Device or resource busy

Another user had the same issue (https://github.com/synesthesiam/rhasspy/issues/29), however, that one was closed due to inactivity (I suppose). In contrast to the problem of that person, I get the error with both these commands.

I would like to debug this, but not sure where to start?

voipep commented 4 years ago

Stupid question: Do you have another service running in the background e.g. Snips?

basnijholt commented 4 years ago

@voipep, thanks for your response. No, I have no other add-on or integration that uses the microphone.

voipep commented 4 years ago

I assume you already tried but I had a similiar problem and it worked when I selected another input device than default in the settings (try and error). Sorry that I can't help that much

synesthesiam commented 4 years ago

If Rhasspy is listening for a wake word when you exec into the Docker container, you'll definitely get the "busy" message. To start debugging, I'd advise turning off the wake word functionality and restarting Rhasspy.

In the most recent release (2.4.17), I also added a button to the web UI that I see on your screen (the green play button). After doing the "Hold to Record", speak, and release, you should be able to hit the button and hear the recorded command. This might help with debugging too.

basnijholt commented 4 years ago

If Rhasspy is listening for a wake word

@synesthesiam, that was indeed the problem!

The microphone is working correctly now. On to solving the next problem :)