I have a Pi Zero with a USB soundcard and a PS3 Eye set up with Rhasspy 2.5-pre in Docker. I’ve set up my asoundrc.conf to be able to play and record from multiple applications at the same time outside of Docker (which indicates to me that my dmix and dsnoop config is working), but then when I try to play back a file from the host and from within the Rhasspy container at the same time, I get an error from aplay:
root@1530daa229ed:/usr/lib/rhasspy-voltron# aplay etc/wav/beep_hi.wav
ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
aplay: main:828: audio open error: Device or resource busy
Has anyone had any success with getting sound to play on the host and inside a Docker container at the same time?
I’ve tried linking my /etc/asoundrc.conf into the container (-v /etc/asound.conf:/etc/asound.conf:ro), making /dev/snd available in the container (--device /dev/snd), and even setting the container to privileged without any success.
When the host is not playing and I have brought /dev/snd and my asoundrc.conf into the container, I can play multiple files from within the container as I would on the host. I’m not quite sure how the dmix ALSA plugin works, but if it accesses the hardware directly through DMA, perhaps the instance inside the Docker container is trying to grab the hardware device and create an entirely new dmix plugin instance within the container instead of using the existing one outside of the container. Any ALSA gurus have any ideas?
Because this is on a Pi Zero, I’d rather not run pulseaudio and hog more CPU…
Any advice would be appreciated! Thanks!


From 
