Selecting default soundcard

My setup:

  • Raspberry Pi 3B+
  • FX-AUDIO USB DAC
  • Most recent Home Assistant OS
  • Spotify Connect (librespot) addon

After connecting USB soundcard I can see it in Hardware as:

- name: 1-1.2
    sysfs: /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2
    dev_path: /dev/bus/usb/001/007
    subsystem: usb
    by_id: null
    attributes:
      BUSNUM: '001'
      DEVNAME: /dev/bus/usb/001/007
      DEVNUM: '007'
      DEVPATH: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2
      DEVTYPE: usb_device
      DRIVER: usb
      ID_BUS: usb
      ID_FOR_SEAT: usb-platform-3f980000_usb-usb-0_1_2
      ID_MODEL: FX-AUDIO-DAC-X6
      ID_MODEL_ENC: FX-AUDIO-DAC-X6
      ID_MODEL_ID: 340b
      ID_PATH: 'platform-3f980000.usb-usb-0:1.2'
      ID_PATH_TAG: platform-3f980000_usb-usb-0_1_2
      ID_REVISION: '0010'
      ID_SERIAL: FX-AUDIO_FX-AUDIO-DAC-X6
      ID_USB_INTERFACES: ':010100:010200:030000:'
      ID_VENDOR: FX-AUDIO
      ID_VENDOR_ENC: FX-AUDIO
      ID_VENDOR_ID: 040d
      MAJOR: '189'
      MINOR: '6'
      PRODUCT: 40d/340b/10
      SUBSYSTEM: usb
      TAGS: ':seat:'
      TYPE: 0/0/0
      USEC_INITIALIZED: '39776960602'

how can I select this soundcard as default soundcard for the system? In spotify connect add-on I can only see two outpus:

  • Default
  • Built-in stereo
    none of both is my USB soundcard.

As always sound is untamed beast on Linux of any kind. I have gained some knowledge.
What I learned:

  1. Audio in HA is piped through this container https://github.com/home-assistant/plugin-audio
  2. What I am missing is USB soundcard entity visible in HA - after spending 3hrs digging in web I found no solution.

ANY hint would be highly appreciated.

Is this some problem with this question or no one never wanted to connect USB soundcard to HA?

1 Like

@bartosz_w
I am interest in connecting a DAC as well.

1 Like

Is wanting decent sound from HA to a audio receiver that big of an anomaly?

3.5mm analog audio out is NOT good sound from a Pi or a PC…

There are lots of USB to optical out sound cards/DACs, and no way to select for them in HA via the GUI in August of 2022? Seriously?

If anyone still looking for a solution, here is my walkthrough for a generic USB Sound Card (5ch analog + 2ch digital).

  1. Check if the hardware is properly initialized: it should be visible under hardwares menu (eg. 1-1.2 - ID_MODEL: USB_Sound_Device).
  2. ha audio info - Shows the current HA audio configuration: Build-in Audio Stereo as output, USB sound card is not visible
  3. pactl list - Card #0: BCM2835 Headphone is detected, USB device is not in the list…
  4. ha audio restart - since I’ve connected the USB device to a running system, it seems natural to restart the docker container first.
  5. pactl list - Card #0: USB Sound Device (stereo and surround profiles), Card #1: FHD Camera (input mono), Card #2: BCM2835
  6. ha audio reload - reload PulseAudio server
  7. ha audio info - output section shows Build-in and USB device
  8. ha audio default output --name alsa_output.usb-0d8c_USB_Sound_Device-00.analog-stereo - sets default audio output
  9. Alternatively, select USB Sound Device as output directly in Spotify add-on, default can remain the RPi’s onboard 3.5jack

Thanks @bartosz_w for the github link!
All other commands are well documented just type ha audio in terminal.

5 Likes

same problem here. I cannot select the USB device from the output in the Spotify add-on, there is only “default” or “3,5mm jack”.

actually to solve it I have installed home assistant in a docker container and I use Raspotify that can output to my USB sound card. anyone tried the @ijavid solution?

today I tried your walkthrough and I solved everything: everything works perfectly, I don’t need anymore to use home assistant inside a docker to use raspotify to play music: the audio quality is the same and now it works also faster and with my USB audio card as output.

Thanks a lot!

hi guys, I am very happy with @ijavid solution but with a problem: every time I restart Home Assistant, default audio output revert back to the 3,5mm jack output.
to make USB the output again, I have to turn on my USB audio card, do a “ha audio reload” and after that I have to set up again the “ha audio default output”.

is there a way to automate it?

1 Like

Have you resolve it? I am in the same situation
I try to automate using automation > action Shh…but nothing

thanks

Amazing, this has solved my problem. As others have noted, only until the next reboot, though. Also, I wish this was easier.

this worked for me (running HA in proxmox)

I’m trying to get a Topping D30 DAC working as an audio output, but can’t even get it to show up in Hardware… USB discovery should be OK, I’ve tried various command line inputs/queries, no dice so far. Have tried rebooting the entire hassio host as well, to no effect. Does anyone have sage advice to offer, or ideas of what questions I should even be asking at this point…?

3 years later, I am back here, with my problem solved by @ijavid ! My setup is working, setting default sound card worked great! Now I have Spotify connect add-on on RPI 3b+ with DAC connected.

guys, i am back with this because i have to ask you: how did you solve the fact that rebooting home assistant loses this command and you have to enter it again every time?