Apple Airplay on Raspberry Pi

We have an old audioset, which looks pretty nice, but is very old skool. Only an audio in cable and nothing else. No bluetooth, no airplay, no streaming.

I have some USB audio output connectors, those are perfect for creating a small audio system with the Raspberry Pi. (as you maybe know, the 3mm jack on the Pi is not that great)

Start with a Pi3 or newer. If you use the older ones you could get some glitches during playback because lack of cpu power.

Start with install the Raspbian Lite images and enable SSH

Configure the Airplay Server:

Install the deps:

# sudo apt-get update sudo apt-get install autoconf automake avahi-daemon build-essential git libasound2-dev libavahi-client-dev libconfig-dev libdaemon-dev libpopt-dev libssl-dev libtool xmltoman

Now lets build and install shairpoint-sync:

# git clone https://github.com/mikebrady/shairport-sync.git
# cd shairport-sync
# autoreconf -i -f
# ./configure --with-alsa --with-avahi --with-ssl=openssl --with-systemd --with-metadata
# make
# sudo make install

The metadata in the configure line is used to be able to show the audio information to an external screen or external service.

Lets start the service and make sure the service starts after a reboot:

# sudo service shairport-sync start
# sudo systemctl enable shairport-sync
# sudo reboot

When the reboot is done, check if the service started:
# sudo systemctl status shairport-sync.service

Make sure the Wifi stays up and running without dropouts:

# sudo nano /etc/network/interfaces

Go to the end of the file and add the lines:
# Disable wifi power management
wireless-power off

Save and do a reboot:
# sudo reboot

Change the audio default:

Because I use an usb adapter for doing audio out, you need to tell alsa to use usb as the default:

# sudo nano /usr/share/alsa/alsa.conf

Replace the 0 to 1 for the following lines:
defaults.ctl.card 0
defaults.pcm.card 0

Save the file and reboot and all should work as expected :)

Inspired by 7-easy-steps-to-apple-airplay-on-raspberry-pi and updating-alsa-config