USB microphone conflicts

Hello community!

Unfortunately I cannot use my USB microphone in rhasspy and outside docker at the same time. I followed the instrucions to map my asound.conf to docker. In rhasspy I selected arecord --> direct sampling dsnoop device. But then rhasspy get’s no input.
Here is my docker-compose configuration and my asound.conf file:

asound.conf:
pi@raspberrypi:~ $ cat /etc/asound.conf

Global alsa-lib configuration

pcm.speakers {
type dmix
ipc_key 1024
slave {
pcm “hw:0,0”
rate 48000
}

bindings {
    0 0
    1 1
 }

}

pcm.microphones {
type dsnoop
ipc_key 1024
slave {
pcm “hw:1,0”
rate 48000
}

bindings {
    0 0
    1 1
 }

}

pcm.!default {

     type asym

     playback.pcm {
             type plug
             slave {
               pcm "speakers"
             }
     }

     capture.pcm {
            type plug
            slave {
               pcm "microphones"
            }
     }

}

docker-compose :
pi@raspberrypi:~ $ cat rhasspy.docker.create
docker run -d -p 12101:12101
–name rhasspy
–restart unless-stopped
-v “$HOME/.config/rhasspy/profiles:/profiles”
-v “/etc/localtime:/etc/localtime:ro”
-v “/etc/asound.conf:/etc/asound.conf:ro”
–device /dev/snd:/dev/snd
rhasspy/rhasspy
–user-profiles /profiles
–profile de

I have a USB playback device and an USB microphone connected to the raspberry. Internal sound card is disabled.
Does the asound.conf looks correct ?
Which device I have to select in rhasspy? Is arecord correct, too, or is pyaudio the right choice ?
Thank you very much, I tried it for a long time without success.

I’m not well-versed in ALSA configs, so I can’t comment there without more research.

However, you may be interested in a recently-contributed PulseAudio example by a Rhasspy community member. It uses docker-compose, but it should be convertable to a plain docker run command.

Assuming you’re using PulseAudio, this might be another way to avoid the device conflicts.

thank you for the link! I have now pulse configured right. But now I have the problem, that the sound from the speaker is heavy distorted. also the wake word engine is very slow and inaccurate.
Running on raspberry 4 4gb…