Sound Problem in Rhasspy Docker Container

Hi there,

first of all i want to say: This project is great! Keep it up!
I also want to say: I did not speak or write english for over 15 years. So please excuse me!

Unfortunately I have a problem with Rhasspy in a docker container. The sounds “beep_hi.wav” etc. cannot always be heard. This makes it difficult to identify whether the wake word has worked or not.

About my system:
Raspberry Pi 3 with Buster
Respeaker 4-mic linear for raspberry pi with connected speaker
Rhasspy in a docker container

I’ve tried a lot. The sound is always played on the host (not in the container) with „aplay beep_hi.wav”.
With “docker exec ID aplay /usr/share/rhasspy/etc/wav/beep_hi.wav” the sound plays only sometimes, sometimes the speaker stays silent. I assume that something goes wrong in the container.

I started the container with

sudo docker run -p 12101: 12101 \
      --restart always \
      --name rhasspy \
      -v "/ home / pi / rhasspy / profiles: / profiles" \
      --group-add $ (getent group audio | cut -d: -f3) \
      --device / dev / snd: / dev / snd \
      synesthesiam / rhasspy-server: latest \
      --user-profiles / profiles \
      --profile de

I also tried „—privileged” and -v “/home/pi/rhasspy/asound.conf:/etc/asound.conf” with the following asound.conf:

pcm.! default {
  type asym
  capture.pcm "mic"
  playback.pcm "speaker"
}

pcm.mic {
  type plug
  slave {
    pcm "hw: 1.0"
  }
}

pcm.speaker {
  type plug
  slave {
    pcm "hw: 0.0"
  }
}

The problem ist he same with all of my ideas. I have read in forums that pulseaudio and ALSA may interfere. However, I don’t know how to fix the problem.

I hope you still have some ideas to solve this problem.

Thanks in advance!

Best wishes

1 Like

He @L_Stuhr, thanks for trying Rhasspy! Do you have any other services on your Pi that would be accessing the speaker? This sounds like an ALSA problem to me.

It may be necessary to change the audio output device in your Rhasspy settings. If you set sounds.aplay.device in your profile, this is like passing an argument to aplay -D with the ALSA device id. You can see a list of them with aplay -L and try them out.

Anyone else have an idea?

Hi synesthesiam,

thank you for your solution!

I just installed raspbian with the image: 2019-09-26-raspbian-buster.img

Then seeed driver (onboard sound turned off):

git clone https://github.com/respeaker/seeed-voicecard.git

cd seeed voicecard
sudo ./install.sh
sudo reboot

Afterwards Docker:

sudo curl -sSL https://get.docker.com | sh
sudo usermod -a -G docker pi
sudo usermod -a -G dialout $ USER
sudo systemctl enable docker
sudo systemctl start docker

Additionally as container (portainer):

sudo docker run -d -p 9000: 9000 --restart always --name portainer -v portainer_data: / data -v /var/run/docker.sock:/var/run/docker.sock portainer / portainer

Then started rhasspy as a container as described above.

I have now tried:

docker exec -it ID / bin / bash
aplay -L

zero
Discard all samples (playback) or generate zero samples (capture)
default: CARD = seeed8micvoicec
seeed-8mic-voice card,
Default audio device
sysdefault: CARD = seeed8micvoicec
seeed-8mic-voice card,
Default audio device
dmixed: CARD = seeed8micvoicec, DEV = 0
seeed-8mic-voice card,
Direct sample mixing device
dsnoop: CARD = seeed8micvoicec, DEV = 0
seeed-8mic-voice card,
Direct sample snooping device
hw: CARD = seeed8micvoicec, DEV = 0
seeed-8mic-voice card,
Direct hardware device without any conversions
plughw: CARD = seeed8micvoicec, DEV = 0
seeed-8mic-voice card,
Hardware device with all software conversions

Then several times each of the following commands:

aplay -D default /usr/share/rhasspy/etc/wav/beep_hi.wav
aplay -D sysdefault /usr/share/rhasspy/etc/wav/beep_hi.wav
aplay –D plughw /usr/share/rhasspy/etc/wav/beep_hi.wav

The sound is played only sometimes. After the sound is played ALSA appears to be blocked, sometimes longer, sometimes shorter.

Do you have any ideas?

Hey guys,

I solved the problem. In the manual of the seeed driver I read:
#The file to play must be mono channel or else the speaker output nothing.

So I changed my asound.conf:
pcm.!default {
type asym
capture.pcm “mic”
playback.pcm “speaker”
}

pcm.mic {
  type plug
  slave {
    pcm "sysdefault"
  }
}

pcm.speaker {
  type plug
  slave {
    pcm "plughw"
    channels 1
  }

Now the sound output is okay. Maybe someone else need this information…

Now I will train my rhasspy! Thank you synesthesiam, your input has brought me to the right place!

2 Likes

You’re welcome, good luck!