Rhasspy - multiple audio errors for USB sound card

Hi all, I’ve been looking for a solution to this issue for some time but haven’t found anyone with exactly the same issue.

I’m running Home Assistant 2022.9.7 on a Raspberry Pi 4B 8GB. I’ve been trying to install a USB sound card but have been unable to get audio to work.

The card is recognised by the system:

Subsystem:
sound
Device path:
/dev/snd/controlC1
ID:
/dev/snd/by-id/usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00
Attributes:
DEVLINKS: >-
  /dev/snd/by-id/usb-C-Media_Electronics_Inc._USB_PnP_Sound_Device-00
  /dev/snd/by-path/platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0
DEVNAME: /dev/snd/controlC1
DEVPATH: >-
  /devices/platform/scb/fd500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/usb1/1-1/1-1.1/1-1.1:1.0/sound/card1/controlC1
ID_BUS: usb
ID_MODEL: USB_PnP_Sound_Device
ID_MODEL_ENC: USB\x20PnP\x20Sound\x20Device
ID_MODEL_ID: '2902'
ID_PATH: platform-fd500000.pcie-pci-0000:01:00.0-usb-0:1.1:1.0
ID_PATH_TAG: platform-fd500000_pcie-pci-0000_01_00_0-usb-0_1_1_1_0
ID_REVISION: '0100'
ID_SERIAL: C-Media_Electronics_Inc._USB_PnP_Sound_Device
ID_TYPE: audio
ID_USB_DRIVER: snd-usb-audio
ID_USB_INTERFACES: ':010100:010200:030000:'
ID_USB_INTERFACE_NUM: '00'
ID_VENDOR: C-Media_Electronics_Inc.
ID_VENDOR_ENC: C-Media\x20Electronics\x20Inc.\x20\x20\x20\x20\x20\x20
ID_VENDOR_ID: 08bb
MAJOR: '116'
MINOR: '6'
SUBSYSTEM: sound
SYSTEMD_USER_WANTS: sound.target
SYSTEMD_WANTS: sound.target
TAGS: ':systemd:'
USEC_INITIALIZED: '3107711475'

However the audio log is showing several errors:

s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service legacy-cont-init: starting
cont-init: info: running /etc/cont-init.d/alsa-mixer.sh
[22:19:45] INFO: Adjust ALSA mixer settings for /dev/snd/controlC0
[22:19:46] INFO: Adjust ALSA mixer settings for /dev/snd/controlC1
cont-init: info: /etc/cont-init.d/alsa-mixer.sh exited 0
cont-init: info: running /etc/cont-init.d/filesystem.sh
cont-init: info: /etc/cont-init.d/filesystem.sh exited 0
cont-init: info: running /etc/cont-init.d/pulse-config.sh
[22:19:47] INFO: Found RaspberryPi system
cont-init: info: /etc/cont-init.d/pulse-config.sh exited 0
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service legacy-services: starting
services-up: info: copying legacy longrun alsa (no readiness notification)
services-up: info: copying legacy longrun pulseaudio (no readiness notification)
s6-rc: info: service legacy-services successfully started
W: [pulseaudio] main.c: Running in system mode, but --disallow-module-loading not set.
W: [pulseaudio] main.c: Home directory of user 'root' is not '/var/run/pulse', ignoring.
W: [pulseaudio] caps.c: Normally all extra capabilities would be dropped now, but that's impossible because PulseAudio was built without capabilities support.
W: [pulseaudio] main.c: OK, so you are running PA in system mode. Please make sure that you actually do want to do that.
W: [pulseaudio] main.c: Please read http://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/WhatIsWrongWithSystemWide/ for an explanation why system mode is usually a bad idea.
W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card1: No such file or directory
W: [pulseaudio] module-udev-detect.c: Failed to open /proc/asound/card0: No such file or directory
E: [pulseaudio] module-rescue-streams.c: module-rescue-stream is obsolete and should no longer be loaded. Please remove it from your configuration.
E: [alsa-sink-USB Audio] alsa-sink.c: ALSA woke us up to write new data to the device, but there was actually nothing to write.
E: [alsa-sink-USB Audio] alsa-sink.c: Most likely this is a bug in the ALSA driver 'snd_usb_audio'. Please report this issue to the ALSA developers.
E: [alsa-sink-USB Audio] alsa-sink.c: We were woken up with POLLOUT set -- however a subsequent snd_pcm_avail() returned 0 or another value < min_avail.
W: [alsa-source-USB Audio] alsa-util.c: Got POLLNVAL from ALSA
W: [alsa-sink-USB Audio] alsa-util.c: Got POLLNVAL from ALSA
E: [alsa-source-USB Audio] alsa-source.c: Error opening PCM device hw:1: No such file or directory
E: [alsa-sink-USB Audio] alsa-sink.c: Error opening PCM device front:1: No such file or directory
[22:25:59] INFO: New ALSA mixer: controlC1
s6-svlisten1: fatal: unable to subscribe to events for /var/run/s6/services/pulseaudio: No such file or directory

I’ve confirmed the /var/run/s6/services directory doesn’t exist but I suspect my problems are bigger than that. I’ve been wondering if the issue is the card itself, but I’ve seen others using USB sound cards based on the same chipset with apparently no issues.

I’ve tried several cards (of the same type), uninstalling and reinstalling the Rhasspy addon, and looking at alsamixer settings to try to resolve. Anyone having similar issues?

Hi all, found the solution, opened Terminal and changed the default audio devices as follows:

Found the names of the input and output devices by entering:

ha audio info

Which returned the following (edited for brevity) where I located the input and output device names for the relevant card by locating the details for USB Audio:

audio:
  application: []
  card:
    - driver: module-alsa-card.c
      index: 0
      name: alsa_card.usb-Generic_USB_Audio-00
      profiles:
        - active: false
          description: Analog Stereo Input
          name: input:analog-stereo
        - active: false
          description: Analog Stereo Output
          name: output:analog-stereo

Entered the following commands:

ha audio default input --name "alsa_input.usb-Generic_USB_Audio-00.analog-stereo"
ha audio default output --name "alsa_output.usb-Generic_USB_Audio-00.analog-stereo"

Ran ha audio info again and confirmed the USB audio device was now set as the default input and output.

Tested audio output in Rhasspy successfully.

2 Likes

I tried this but it didn’t work. What is causing this error about “None stream”?