Fixing HifiBerry and Raspberry Pi sound after update

June 19th, 2020

I updated my Raspberry Pi 4 which I use for playing music with the great, free and open source MPD server.

After reboot it stopped playing music. ;(

The cause was this update in May/June 2020, due to a change in audio configuration. MPD was still working but the sound was now not routed through the HifiBerry soundcard, but through the audio/headphones, simply because a new HW card was defined: headphones/analog audio out.

The solution was easy.

aplay -l shows the Hifiberry the third card instead of the second, the new headphones was now the second.

 $ 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 
card 2: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 [HifiBerry DAC HiFi pcm5102a-hifi-0]
Subdevices: 0/1 
Subdevice #0: subdevice #0

All I had to do is to edit /etc/asound.conf and increase 1 to 2:

pcm.!default {
type hw card 2
}
ctl.!default {
type hw card 2
}

Restart MPD and everything was working like before. 😉

sudo systemctl restart mpd

 

Leave a Reply