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

3 thoughts on “Hifiberry used for surround sound playback in XBMC on Raspberry pi

    1. pretender Post author

      Hi Luksol, I did not try out 1080p that much as my TV does only support 720p 🙁 Though it should be possible but might require some tweeks. Also I think DTS should work but as my surround receiver (for some weird reason only Panasonic understands) only support Dolby digital I have not tested it.

      I have been made aware that one tweek is needed in order to get enough memory for the GPU. I added that to the blog.

      Reply
  1. Sys64

    Thank you for this very good tutorial.
    I have it running on 1080p with surround sound without any problems (after 30 mins test with 4 fullHD movies).

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *