Hifiberry used for surround sound playback in XBMC on Raspberry pi

After some poking and hacking around in Rasbian and Raspbmc I got surround sound playback in XBMC on the Raspberry Pi.

It could be that there is a better way of achieving this but for now I did not find it. If you have suggestions for improvement please let me know.

Here is what I did on a fresh installation of Raspbmc:

In order to get the newest firmware and more package options add the Rasbian repositories to the Raspbmc in /etc/apt/sources.list. The changes are highlighted.

deb http://archive.raspbian.org/raspbian wheezy main contrib non-free rpi
deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
deb http://archive.raspberrypi.org/debian/ wheezy main

After this add the raspberrypi.org public key and update the system from the newly added repositories then add the needed sw packages. Thereafter force update the firmware and reboot.

wget http://archive.raspberrypi.org/debian/raspberrypi.gpg.key
sudo apt-key add raspberrypi.gpg.key
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install rpi-update curl alsa
sudo -E RPI_UPDATE_UNSUPPORTED=0 rpi-update
sudo reboot

Add the following lines to /etc/modules

snd_soc_bcm2708
snd_soc_bcm2708_i2s
bcm2708_dmaengine
snd_soc_wm8804
snd_soc_hifiberry_digi

After a reboot run the test script provided by Crazy-audio

wget www.hifiberry.com/files/digi/check-system
mv check-system check-system.dac
chmod u+rx ./check-system.dac
./check-system.dac

Use the latest RaspBMC XBMC test builds from miappa at http://forum.xbmc.org/showthread.php?tid=176043

wget -O xbmc-13-20140404-nc3.tar.gz http://goo.gl/yAe9hI --no-check-certificate
pv xbmc-13-20140404-nc3.tar.gz | tar xzf - -C /home/pi/.upgrade
sudo cp /home/pi/.upgrade/xbmc-13-20140404-nc3/{fixup_x.dat,start_x.elf} /boot
ln -sfn /home/pi/.upgrade/xbmc-13-20140404-nc3/xbmc-bcm /home/pi/.xbmc-current
sudo reboot

Then make sure XBMC uses dvdplayer for video playback by changing /home/[user]/.xbmc-current/xbmc-bin/share/xbmc/system/advancedsettings.xml

<advancedsettings>
  <video>
    <defaultplayer>dvdplayer</defaultplayer>
    <defaultdvdplayer>dvdplayer</defaultdvdplayer>
  </video>
</advancedsettings>

Change the audio playback and audio pass through as show in the pictures

 

XBMC-audio-1 XBMC-audio-2

Now there is surround sound via the optical link if the audio amplifier supports the audio pass through,

Edit 16/04-2014:

It might also be needed to change the GPU memory split as DVDPlayer requires more GPU memory. This is done in /boot/config.txt where the following line need to be added or changed. Different memory splits can be tested. Thanks to Jimmy Dom for at crazy-audio forum for pointing this out.

gpu_mem_512=256

My Hifiberry Digi finally arrived

I finally got my Hifiberry Digi this week :)

It was delayed as I put the wrong house number on the order and the Danish postal service was unable to figure out that the package was for number 19 instead of 29.

But here it is next to the Raspberry pi:

Hifiberry with accessories + pi

Hifiberry with accessories + pi

After soldering in the 2-by-4 header and mounting the nylon spacer it all looked like this:

Hifiberry on Rpi

After some problems with my SD card and SD card writer I managed to get the latest Raspbian image running and a few minutes later I had sound via the optical output.

All I did was to follow the guide provided by Crazy-Audio on http://www.hifiberry.com/….

Here is what I did:

Get the newest Kernel

sudo rpi-update
sync
sudo reboot

Add the following lines to /etc/modules

snd_soc_bcm2708
bcm2708_dmaengine
snd_soc_wm8804
snd_soc_hifiberry_digi

I also had to comment out the following line in /etc/modprobe.d/

blacklist i2c-bcm2708

After a reboot I ran the test script provided by Crazy-audio

wget www.hifiberry.com/files/digi/check-system
mv check-system check-system.dac
chmod u+rx ./check-system.dac
./check-system.dac

Now the next task will be to get the system running with XBMC