Microphone and Speaker not available to Rhasspy but appear in arecord and aplay

Hello -
I am having an issue with my Rhasspy setup in which I attach my Anker PowerConf speakerphone into my Raspberry Pi. it shows in my audio menu as both an input and output device. When I run aplay and arecord it is appearing there, but it is not as an option in Rhasspy to setup for either audio recording or audio playing in the settings.

Details of my build are as follows:
I built a brand new Raspberry PI 4 4GB Ver 1.2 for this project. I used the the NOOB SD card and am running Raspbian Version 10 Buster. I then followed the Rhasspy Installation instructions here to install docker. I did have an error about the localization and I get an error when starting my PI that says

-bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)

However, it did appear to be successful otherwise and I was able to continue with a docker installation of Rhasspy. I am currently running 2.5.8.

Last night I was able to quickly work through all of the steps and was able to control devices by verbal command. I then shutdown everything properly and moved my setup to another location. When I powered back my microphone and speaker weren’t available to Rhasspy. Here are the relevant snippets I believe: first my aplay -l and then the Audio Playing options from the settings screen, then the arecord -l.

aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 8/8
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
  Subdevice #4: subdevice #4
  Subdevice #5: subdevice #5
  Subdevice #6: subdevice #6
  Subdevice #7: subdevice #7
card 1: PowerConf [Anker PowerConf], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

Audio Playing Setting
audio playing

Here is my arecord -l

**** List of CAPTURE Hardware Devices ****
card 1: PowerConf [Anker PowerConf], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

I am assuming I did something that was ethereal in my original setup and need to setup something to start on boot or a permission issue of some sort, but all the threads I have pulled on have come loose. Could someone please point me in the proper direction to correct this?

You may struggle with the Anker power conf as hopefully there has been a firmware upgrade since I last tried but that is another matter.

sudo nano /etc/modprobe.d/alsa-base.conf

options snd_usb_audio index=0
options snd_bcm2835 index=1
options snd slots=snd-usb-audio,snd-bcm2835

Just sometime makes things easier as now any usb snd card when plugged in will be index 0 or will be after a unplug/replug but just reboot and check that aplay -l has now a different order

Check that you have shared /dev/snd in your docker run and that even if you create a /etc/asound.conf unless you link or create one in the container it will not be seen.

1 Like

Thank you for suggestions. I created the alsa-base.conf file and restarted the pi. And I confirmed that the Anker was now at index 0. Unfortunately, that did not make any changes, Rhasspy still showed only the CARD=headphone, dev=0. I also confirmed that I did share the /dev/snd in the docker run. However, it dawned on me that we clearly changed the index in the pi and Rhasspy still was not seeing it, maybe there was a problem with the docker container communicating with the pi. I completed a

docker restart rhasspy

And everything came right back the way it was supposed to. It now works with no issues. I never thought to restart the docker container. Is there a downside to restarting the rhasspy in that manner?

1 Like

Give us a shout and review of the Anker as if what you did worked no probs.

I had problems that seemed to be due to usb sleep and maybe can have another go at trying to fix.
I have one here and left it as it was a new product and expected a firmware fix.

The problem was you would miss the first second(s) of notifications as if the unit needed to wake.

I am having what may be similar behavior, it takes a second or two for it to respond. For instance, I need to prefix , ahead of any message so the whole message is spoken and the wake tone is not sounded. I am going to continue to work with it and will put something over in hardware once I figure out what is the Anker and what is the operator.

I do have another issue though. I have confirmed through several reboots, that in order for Rhasspy to see the Anker I have to complete that docker restart. Rhasspy is running after the reboot, but the device is not available until the restart. Is that normal behavior? Is there some sort of file to automatically restart the container after a reboot?

So after a reboot you have to restart the container each time?

Maybe delete that container and do the docker run once more with the anker connected as it is now and see if that woorks? Apols but dunno.
I love Docker as equally at times I hate it, its brilliant until you have a problem.
Maybe it starts with a state that did not have the anker and is somehow still persistent?
Or script a docker restart maybe via a service or .profile or something?

PS I did wonder if usbcore.autosuspend=-1 in /boot/cmdline.txt would solve things and never did check

I gave deleting and creating a new docker container a go with the Anker plugged in and although it gave me much nicer formatted options in the drop down, I still have to complete a docker restart on rhasspy for it to see the Anker.

I think an issue is that the pi does not recognize the Anker on bootup if attached. It has to be unplugged and replugged in before the pi recognizes it.

It seems almost like Rhasspy bonds the available mic and speaker options available to the container when it starts up and doesn’t recognize new hardware when plugged in (at least this Anker) after the container is started. I wonder if I could trigger a container restart when a usbdevice is connected.

You’ve given me a couple of trails to work down. Thank you for your help. I’ll post back what I figure out here over the next couple of days.

I will root mine out as it is around.

It might not be the Pi or Docker as its really usb or bluetooth and that can cuase problems if both connect.
Have you got a bluetooth connection as maybe try untrusting that connect and just via USB.
Also give it a check if there is a firmware update via the android app.

Also I was never really sure if there was any difference on the usb port you use as the type c is marked power the type a usb

I went ahead and tried using the pi’s 2.0 usb ports and the 3.0 usb ports. Both have the same behavior. When the pi reboots, the Anker has to be unplugged and re-plugged in again for the pi to recognize it. When they are plugged in, Rhasspy does not “see” the Anker until I do a docker restart of Rhasspy.

To confirm, I am connecting the Anker via USB. It is not paired via bluetooth (and I’ve verified that). I have upgraded to the latest firmware on the PowerConf.

I was thinking about the 2nd port on the anker as that did always confuse me.
But must be docker I guess, will have a play with mine

Yeah if you connect to the docker rhasspy

docker exec -it rhasspy /bin/bash

root@18a31cc7fb1c:/# aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
  Subdevices: 4/4
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1
  Subdevice #2: subdevice #2
  Subdevice #3: subdevice #3

But actually when I went back to the host aplay -l didn’t show the powerconf as it had timed out and gone to sleep.

I removed the usb plugged back in checked aplay -l on the host

docker stop rhasspy
docker system prune
docker run -d -p 12101:12101 \
      --name rhasspy \
      --restart unless-stopped \
      -v "$HOME/.config/rhasspy/profiles:/profiles" \
      -v "/etc/localtime:/etc/localtime:ro" \
      --device /dev/snd:/dev/snd \
      rhasspy/rhasspy \
      --user-profiles /profiles \
      --profile en

docker exec -it rhasspy /bin/bash

Now its back

But restart and on the host it doesn’t show until you pull the usb cable.

I remember it being a bit weird hence why I don’t use it and its annoying as its only linux.
Windows and my phone when I do use it it seems to work fine but yeah there are a few weird ones with this.

Even when you power cycle IE shutdown pull power/ apply power the powerconf is not on the host until you unplug and plug in again.

I understand why you moved away from it. There are a lot of unknowns with this Powerconf. I was thinking this afternoon maybe it might have something to do with the Powerconf switching into a charging mode versus being in a speaker/mic mode. IDK. It definitely works fine for testing and dev, but I don’t think it is going to work for me as a set it and forget it device that would behave gracefully with just day to day operation. I ordered another usb speakerphone this evening and will see if it behaves better.

I do wonder if there is an issue with Rhasspy docker installations not recognizing a newly plugged in mic/speaker that is plugged in after the container is started. I’ll see if that is an issue with this new speakerphone or not or if it was limited to the Anker.

Once again, I really appreciate your help on this.

I am sorry but what happens has me totally stumped as its completely device side as nothing not dmesg registers until an unplug.

You can go into the soundcore app and turn off powersave and also check firmware updates but as far as linux is concerned the device is none existent until unplug.

Its the same with Ubuntu & x86 also Windows.