Shairport Sync

My son Max likes to listen to music at night, the music helps him sleep. When Max moved in to his own room, I bought an Airport Express so that I could stream music from my iPad to his room. Just recently, the Airport Express gave up the ghost – I think it overheated and something blew as all it would do is show a steady yellow light.

Fortunately, I have a number of Raspberry Pi’s lying around and suspected that there would be some open source solution to replace the Airport Express at half the cost. During my Googling I happened upon Shairport Sync. The software is actually unmaintained, but there are a number of forks that still are.

I tried my Raspberry Pi3 first as that has a headphone jack, but when I got Shairport sync working I noticed that the sound quality from the Pi3 was really poor. A week or so later, the Raspberry Pi Zero W was released. I decided to get one for Max, and also a hi-fi Digital to Analogue Converter (DAC) to address the issue with sound quality. Some soldering was required to attach the 40-pin header to both the Pi’s GPIO pins and the DAC.

Then came the installation of the Shairport Sync software.

Step 1

In a terminal on the Pi, run the following commands:

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

Step 2

Get the shairport sync software from GitHub:

git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync

Step 3

Create a shairport sync group and user:

getent group shairport-sync &>/dev/null || sudo groupadd -r shairport-sync >/dev/null
getent passwd shairport-sync &> /dev/null || sudo useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null

Step 4

Configure and compile the software (this will take a few minutes on the Pi Zero):

autoreconf -i -f
./configure --sysconfdir=/etc --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-systemd
make
sudo make install
sudo systemctl enable shairport-sync
chmod 755 ./scripts/shairport-sync
sudo cp ./scripts/shairport-sync /etc/init.d/shairport-sync/
sudo update-rc.d shairport-sync defaults 90 10

Step 5

Edit the shairport-sync.conf file and set defaults – such as the name of the share

sudo vi /etc/shairport-sync.conf
general =
{
  name = "Raspberry Pi Zero W";
};

Finally restart the pi:

shutdown -r now

And hopefully, the Pi will appear in iTunes:

Shairport

Pi appears as an AirPlay speaker in iTunes

Advertisements