AirPlay on the RaspberryPi

AirPlay on the RaspberryPi

I bought a Wolfson Audio Card and a new RaspberryPi (as my original Pi is too old to work with the card…) for the sole purpose of using it as a sound source for my stereo. The idea would be to have AirPlay enabled to allow iTunes / my iPhone to stream to it and to have MPC/MPD installed so I can stream radio / play high-res audio files over a network share. This requires the wonderful Shairport.

This is the process I went through.

  • Download Ragnar’s wheezy .img file (that includes the patches to get the Wolfson card to work)
  • I zero’d the SD card
  • sudo diskutil unmount /dev/disk1s1
    sudo dd bs=1m if=~/RasPi/2014-01-07-wheezy-raspbianW.img of=/dev/rdisk1
    sudo diskutil unmount /dev/disk1s1
    sudo diskutil unmount /dev/disk1s2
  • Boot and access (I do this headless)
  • sudo apt-get update
  • Install netatalk – this allows the pi to be seen on the .local domain – sudo apt-get install netatalk. This installs netatalk and avahi for Bonjour services.
  • Added a afp.service and a ssh.service file to /etc/avahi/services following this to get pretty icons and the like.
  • Install shairport as detailed here.
    git clone
    cd shairport
    sudo make install

    Move the scripts into the correct locations:

    sudo cp scripts/debian/init.d/shairport /etc/init.d/.
    sudo cp scripts/debian/default/shairport /etc/default/.
    sudo cp scripts/debian/logrotate.d/shairport /etc/logrotate.d/.

  • I changed the name the Pi broadcasts and made the service start on boot as per instructions found when googling.
  • Run the lineout script from the use_case_scripts directory. This selects the Wolfson card as the sound output device.
  • sudo apt-get install mpd mpc flac to get internet streaming and file playing.
  • For hi-def audio: sudo apt-get install lxmusic xmms2 xmms2-plugin-all volumeicon-alsa mpg123 mplayer
  • To be able to load from usb sticks etc with HFS support: sudo apt-get install hfsutils hfsprogs

After all that you should have a Pi that appears as a set of AirPlay speakers within iTunes and on your iPhone. You should also be able to play music using MPC.