Saturday 22 March 2014

RuneAudio with HiFiBerry

At home I have a Raspberry Pi with a HiFiBerry DAC plugged in, in a UniPi case, running RuneAudio (phew that's a lot of COTS integration). It's an awesome high quality audio source!

With the lid off

With the lid on - nice and neat

I've desoldered the original 3.5mm jack and composite video connectors and used the 3.5mm jack hole to mount a new 3.5mm jack (it's just one of these Altronics P0086 screw together jacks).

Here's some quick notes on how to get HiFiBerry working with Rune Audio 0.2:

Flash and update to latest

Flash RuneAudio 0.2 onto a SD card and plug it into the Raspberry Pi.
Log into the Raspberry Pi using SSH with user name "root" and password "rune".

Update: Midnight on the Rune Audio forum says you don't need to update everything, just update the kernel with the following commands so give this a try first:
pacman -Sy linux-raspberrypi linux-api-headers kmod
pacman -Sy linux-firmware raspberrypi-firmware-bootloader raspberrypi-firmware-bootloader-x raspberrypi-firmware-tools


Previously this blog post had the following, you probably don't need to update everything:
Run "pacman -Syu" and wait a while for the system to update.

Reboot the Raspberry Pi by running the command "reboot".

Load kernel modules

Log into the Raspberry Pi using SSH again, but note that the IP address allocated to the Raspberry Pi will probably be different due to the network subsystem being upgraded.
Edit /etc/modules-load.d/raspberrypi.conf (use nano or vim). Comment out snd-bcm2835, and add snd_soc_pcm5102a and snd_soc_hifiberry_dac. Your raspberrypi.conf file should contain the following after edits:

bcm2708-rng
#snd-bcm2835
snd_soc_pcm5102a
snd_soc_hifiberry_dac

Save the file and reboot by running the command "reboot".

Configure MPD

Log into the Raspberry Pi using SSH again.
Run the command "aplay -l" and examine the output. On mine the following showed:

**** List of PLAYBACK Hardware Devices ****
card 2: sndrpihifiberry [snd_rpi_hifiberry_dac], device 0: HifiBerry DAC HiFi pcm5102a-hifi-0 []
  Subdevices: 0/1
  Subdevice #0: subdevice #0

Note the number next to card and device (in my case 2 for card and 0 for device).
Edit the file /etc/mpd.conf (use nano or vim). 
Look for the mixer_type setting and change it to software:
mixer_type      "software"

Look for the first audio_output entry and change it to the following (enabled should be set to yes, change name to HiFiBerry or another name of your choosing, and change the device value):
audio_output {
enabled         "yes"
type            "alsa"
name            "HiFiBerry"
device          "hw:2,0"
dsd_usb         "yes"
}

Note that for the device setting, the numbers following hw: need to match your card and device numbers shown by "aplay -l" previously. For mine, this needed to be set to "hw:2,0".

Final Restart

Reboot the Raspberry Pi by running the command "reboot". After the Raspberry Pi boots back up, you should be able to play music :)