Spotify connect and USB DAC

Raspberry Pi related support

Spotify connect and USB DAC

Postby daoane » 03 Sep 2020, 09:51

I have created this thread for USB DAC and Spotify connect because troubleshooting information in the Spotify connect thread is only concerned with DAC HATs and difficult to navigate (multiple questions/answers intertwinned). The aim is to get my setup working and at the same time create instructions for a correct USB DAC setup. I am grateful for any help.

---------------
Problem:
To get Spotify Connect to work with an USB DAC on Raspberry Pi 4 (system summary and information below). How to configure the volume control (mixer) of Alsa.

I start from the following situation:
  • Audio output to the USB DAC works fine from RuneAudio (e.g through spotifyd service; but I want to have the possibility to play directly from the RuneAudio server)
  • I have installed the spotify connect according to the instructions in spotify-connect-on-runeaudio-t6315.html. After confirming that the service starts with the on-board audio and unsuccessful attempts to reconfigure for USB DAC, I have turned off on-board audio in the RuneAudio settings to avoid confusion of device parameters.

Based on the working command for the on-board audio (same as in the instructions for spotify-connect-on-runeaudio thread), I tried to adapt the command for the USB DAC. Here is a simple attempt with only the device number from alsamixer and "mixer" name from amixer:

Code: Select all
root@runeaudio+R e5:~ # ./spotify-connect-web.sh --name RuneAudio --device 0 --mixer "USB Mixer" --username aaaaa --password bbbbb --bitrate 320
Loading Spotify library...
Traceback (most recent call last):
  File "main.py", line 14, in <module>
    from connect import Connect
  File "/usr/src/app/connect.py", line 9, in <module>
    from console_callbacks import audio_arg_parser, mixer, error_callback, connection_callbacks, debug_callbacks, playback_callbacks, playback_setup
  File "/usr/src/app/console_callbacks.py", line 24, in <module>
    audio_arg_parser.add_argument('--mixer', '-m', help='alsa mixer name for volume control', default=alsa.mixers()[0])
IndexError: list index out of range


The error is always the same, also when I skip the mixer parameter: IndexError. As far as I can see, python tries to parse the mixer parameter, but it doesn't correspond to any of the available list entries (I am not sure where the list content originates, Alsa?). Skipping the mixer parameter (as it is not present in the Alsamixer main panel) apparently is not allowed, and "USB Audio" (taken from amixer info) apparently is not part of the list. Obvious is the mismatch between Alsamixer information (no mixer) and amixer info ("USB Mixer).

Main question:
What parameters do I have to use to make this work?
Secondary question:
Is there a way to send the data directly to USB and the DAC? This would avoid the described trouble with the alsa mixer volume control in an elegant way that potentially also increases audio quality by preventing Alsa and Pulsaudio from tinkering with the data (instead, use the manual volume control of the DAC or amplifier).

---------------
System and Alsa information:
---------------

System information from RuneAudio settings:


RuneAudio e5 20200830 • RuneAudio
Hardware Raspberry Pi 4 Model B Rev 1.1
SoC BCM2711 • 4 Cortex-A72 @ 1.5GHz • 4GB
Output Device iFi (by AMR) HD USB Audio
Kernel 5.4.59-1-ARCH

Alsamixer main panel and system information for cards and devices:


Code: Select all
┌────────────────────────────── AlsaMixer v1.2.3 ──────────────────────────────┐
│ Card: iFi (by AMR) HD USB Audio                      F1:  Help               │
│ Chip: USB Mixer                                      F2:  System information │
│ View: F3: Playback  F4: Capture  F5: All             F6:  Select sound card  │
│ Item:                                                Esc: Exit               │
│                                                                              │
│                                                                              │
│                                                                              │
│                This sound device does not have any controls.                 │
│                                                                              │
│                                                                              │
│     

┌───────────────────────────── /proc/asound/cards ─────────────────────────────┐
│ 0 [Audio          ]: USB-Audio - iFi (by AMR) HD USB Audio                   │
│                      iFi (by AMR) iFi (by AMR) HD USB Audio at usb-0000:01:00│
└###############################################################               ┘

┌─────── /proc/asound/devices ───────┐
│  0: [ 0]   : control               │
│ 16: [ 0- 0]: digital audio playback│
│ 33:        : timer                 │
└────────────────────────────────────┘



Information about the mixer:

Code: Select all
root@runeaudio+R e5:~ # amixer info
Card default 'Audio'/'iFi (by AMR) iFi (by AMR) HD USB Audio at usb-0000:01:00.0-1.1, high speed'
  Mixer name   : 'USB Mixer'
  Components   : 'USB20b1:3008'
  Controls      : 3
  Simple ctrls  : 0


Device list according to aplay:

Code: Select all
root@runeaudio+R e5:~ # aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Audio [iFi (by AMR) HD USB Audio], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


PCM list according to aplay:

Code: Select all
root@runeaudio+R e5:~ # aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default
    Default Audio Device
sysdefault
    Default Audio Device
default:CARD=Audio
    iFi (by AMR) HD USB Audio, USB Audio
    Default Audio Device
sysdefault:CARD=Audio
    iFi (by AMR) HD USB Audio, USB Audio
    Default Audio Device
front:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    Front output / input
surround21:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Audio,DEV=0
    iFi (by AMR) HD USB Audio, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
daoane
 
Posts: 3
Joined: 02 Sep 2020, 14:00
Location: Sweden

support RuneAudio Donate with PayPal

Return to Raspberry Pi

Who is online

Users browsing this forum: cmh714 and 9 guests