So somewhere along the line I started using iTunes to plat music, and also started using Apple’s Airplay to stream music to Airport Express base stations.
My oldest Airport Express has had a long hard life. It’s power supply failed about 5 years ago. I gave it a new lease of life by rigging a new power supply. Now at nearly 11 years of age, it is starting to give up the ghost. So, I decided to replace it with an open solution, using a Raspberry Pi Zero, PHAT-DAC audio board, and shairport airplay receiving software.
Both of these have now arrived from The Pit Hut:
The first order of work was to solder the GPIO headers onto both, which gave a result looking like this:
The next step was to get shairport working. You can find a number of tutorials on installing shairport, including the following
- How-To: Turn your Raspberry Pi into a AirPlay receiver to stream music from your iPhone
- Using the Raspberry Pi as an AirPlay server
- Hi-Fi Audio via AirPlay on Raspberry Pi
Before starting the shairport installation, it is first necessary to install the drivers for the pHAT DAC. Instructions can be found on the Pimoroni website.
After that, I got Shairport going, but with one major drawback – the audio was out of sync with iTunes. It seems quite a few people have encountered this, and a fork of shairport which addresses the problem now exists in the guise of shairport-sync.
Installing this was relatively straightforward, starting with pulling down the source code:
$ git clone https://github.com/mikebrady/shairport-sync.git
Then, after going into the shairport-sync directory, the following commands were all I needed to do the install (all run as root – I’m lazy):
# apt-get install autoconf automake libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev
# autoreconf -i -f
#./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd --sysconfdir=/usr/local/etc
# make
# getent group shairport-sync &>/dev/null || groupadd -r shairport-sync >/dev/null
# getent passwd shairport-sync &> /dev/null || useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null
# make install
# systemctl enable shairport-sync
# systemctl start shairport-sync
All of these steps are explained in more detail in shairport-sync’s README.md file.
The next part of this project is to build an on-off switch for my new Airplay receiver!