Bug Report
- rPi 4
- External USB DAC (Topping E30)
- Volumio
cat /etc/os-release
2.917 build dd2a4339faaeb892c7f467e7dc8d424aefb0bd03
- Nanosound 1.8.6
- Nanosound 1.2.3
-
uname -a
: Linux volumio 4.19.118-v7l+ #1311 SMP Mon Apr 27 14:26:42 BST 2020 armv7l GNU/Linux
Bug description
The plugin can be installed manually or by using the pre configured image without a problem. I can see the additional nav menu entry in the Volumio UI. CDs get read and I can see the track list. The CD and any track can be played and I can see the progress.
The plugin messed up the ALSA config. Running the CLI player list for the sound cards results in the following error output:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (0): Invalid argument
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (1): Invalid argument
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (2): Invalid argument
ALSA lib conf.c:1182:(parse_value) card is not a string
ALSA lib conf.c:1852:(snd_config_load1) /data/nanosound_cd/asound.conf:2:0:Invalid argument
ALSA lib conf.c:3615:(config_file_open) /etc/asound.conf may be old or corrupted: consider to remove or fix it
ALSA lib conf.c:3537:(snd_config_hooks_call) function snd_config_hook_load returned error: Invalid argument
ALSA lib conf.c:3986:(snd_config_update_r) hooks failed, removing configuration
aplay: device_list:277: control open (5): Invalid argument
While the output should be this:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 IEC958/HDMI [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: ALSA [bcm2835 ALSA], device 2: bcm2835 IEC958/HDMI1 [bcm2835 IEC958/HDMI1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
Subdevices: 3/3
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
card 2: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 5: E30 [E30], device 0: USB Audio [USB Audio]
Subdevices: 1/1
Subdevice #0: subdevice #0
Additional Info
cat /proc/asound/cards
0 [ALSA ]: bcm2835_alsa - bcm2835 ALSA
bcm2835 ALSA
1 [Headphones ]: bcm2835_headphonbcm2835 Headphones - bcm2835 Headphones
bcm2835 Headphones
2 [sndrpihifiberry]: RPi-simple - snd_rpi_hifiberry_dac # <=== THIS ONE SOMETIMES GETS REMOVED. REASON UNKNOWN.
snd_rpi_hifiberry_dac
5 [E30 ]: USB-Audio - E30
Topping E30 at usb-0000:01:00.0-1.3, high speed
$ ls /dev
# …
cdrom loop6 ram3 tty11 tty37 tty62 vcsm
# …
(i) Card 5 is the DAC
$ cat /proc/asound/modules
0 snd_bcm2835
1 snd_bcm2835
5 snd_usb_audio
The nanosound CD conf
$ cat /data/nanosound_cd/asound.conf
defaults.pcm.card 2
defaults.ctl.card 2
defaults.pcm.rate_converter "speexrate_best"
pcm_slave.x4 {
pcm "hw:2,0"
rate 176400
}
pcm_slave.x2 {
pcm "hw:2,0"
rate 88200
}
pcm.rate_convertx4 {
type rate
slave x4
converter "speexrate_best"
}
pcm.rate_convertx2 {
type rate
slave x2
converter "speexrate_best"
}
The external/ card 5/ hw5:0
DAC has the following capabilites:
$ cat /proc/asound/card5/stream0
Topping E30 at usb-0000:01:00.0-1.3, high speed : USB Audio
Playback:
Status: Running
Interface = 1
Altset = 1
Packet Size = 72
Momentary freq = 44104 Hz (0x5.8358)
Feedback Format = 16.16
Interface 1
Altset 1
Format: S32_LE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
Data packet interval: 125 us
Interface 1
Altset 2
Format: S32_LE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
Data packet interval: 125 us
Interface 1
Altset 3
Format: SPECIAL DSD_U32_BE
Channels: 2
Endpoint: 1 OUT (ASYNC)
Rates: 44100, 48000, 88200, 96000, 176400, 192000, 352800, 384000, 705600, 768000
Data packet interval: 125 us
Efforts to fix the error
- Plugins > Installed Plugins > Nanosound CD > Settings > Auto reconfig audio + restart rPi > not working
- Changing the
/data/nanosound_cd/asound.conf
as shown in this thread > not working
- Restarting after above change > WORKING
Working config
$ cat /data/nanosound_cd/asound.conf
defaults.pcm.rate_converter "speexrate_best"
pcm.!default {
type plug
slave {
pcm "hw:5,0"
rate 44100
}
}
pcm.rate_convertx2 {
type plug
slave {
pcm "hw:5,0"
rate 88200
}
}
pcm.rate_convertx4 {
type plug
slave {
pcm "hw:5,0"
rate 176400
}
}
ctl.!default {
type hw
card 5
}
So it boils down to an invalid config from the plugin not being able to pick up the active, external DAC.
There are a couple of things I noticed, aside from a CD playing without audio output:
- Preinstalled img, distributed by Nanomesh: Nanosound CD does not detect the DAC. It uses I2C per default
- Manual installation of the plugin (settings > plugins), uninstallation, re-installation causes duplicate
</data/nanosound_cd/asound.conf>
lines in /etc/asound.conf
. I notices in the install log (+ details) in the plugins screen that you check for duplicate plugins. You might want to do the same for pre-existing config lines. The line echo "</data/nanosound_cd/asound.conf>" | sudo tee -a /etc/asound.conf
in your install.sh
Bash Script is the source.
- Switching the settings to I2C (in an effort to return back to the E30) results in an non recoverable error: The settings page stays empty. Note: I did not check the frontend PHP logs to diagnose the reason, but I assume it’s a combination of lousy code that crashes silently on the error or uses error suppression and aborts there. I would probably have to reconfigure FastCGI/PHP-FPM to get error reporting and then check the logs.
- Bonus: You could easily speed up installs by checking if certain apt packages exist upfront:
dpkg-query -W -f='${Status}\n' vlc 2>/dev/null | grep -c "installed"
returns 1
for installed and 0
for not installed.