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:


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 :)


  1. How do I use vim on my rasp?

    1. From the command line, run "vim [file you want to edit]", e.g. "vim /etc/mpd.conf". From there vim will start. Use the arrow keys on the keyboard to move the cursor around, and find the line you want to edit. Now press "i" to go into insert mode (vim will show -- INSERT -- at the bottom of the screen). Edit the line as you normally would using the cursor keys to move around, and type on the keyboard to make changes.

      When you're done making changes, press Escape once and the "-- INSERT --" at the bottom of the screen will disappear. Now type ":w" to write the file to disk, and then :"q" to quit.

      For more info about vim, take a look at the tutorial here:

    2. This comment has been removed by the author.

  2. This comment has been removed by the author.

  3. I have the HiFiBerry DIGI board ( spdiff output). Had to change

    snd_soc_hifiberry_dac into

    [root@runeaudio ~]# aplay -l
    **** List of PLAYBACK Hardware Devices ****
    card 2: sndrpihifiberry [snd_rpi_hifiberry_digi], device 0: HifiBerry Digi wm8804-spdif-0 []
    Subdevices: 1/1
    Subdevice #0: subdevice #0
    [root@runeaudio ~]# cd ..
    [root@runeaudio /]# nano etc/mpd.conf
    [root@runeaudio /]# reboot

  4. It doesn't work for my, "aplay -l" says "no soundcard found", and I have this in dmesg:

    [erwan@alarmpi ~]$ dmesg|grep snd
    [ 4.505196] snd-hifiberry-dac snd-hifiberry-dac.0: ASoC: CPU DAI bcm2708-i2s.0 not registered
    [ 4.567966] snd-hifiberry-dac snd-hifiberry-dac.0: snd_soc_register_card() failed: -517
    [ 4.616928] platform snd-hifiberry-dac.0: Driver snd-hifiberry-dac requests probe deferral
    [ 6.084316] snd-hifiberry-dac snd-hifiberry-dac.0: ASoC: can't create pcm HifiBerry DAC HiFi :-22
    [ 6.110234] snd-hifiberry-dac snd-hifiberry-dac.0: ASoC: failed to instantiate card -22
    [ 6.137238] snd-hifiberry-dac snd-hifiberry-dac.0: snd_soc_register_card() failed: -22
    [ 6.161783] snd-hifiberry-dac: probe of snd-hifiberry-dac.0 failed with error -22

  5. Buy Electronic Components in Online for affordable prices at Component Buy. Get 25% discount on Semiconductor micro controller relays Connectors and many more