Home>>Stream audio from Apple devices to Raspberry Pi

What you'll need

Let's start

First things first, let's get PINN Lite and put it on our SD card. PINN is a great alternative to RPi's official NOOBS. I usually use Apple PI Baker to prepare card for NOOBS and just copy PINN files. If you are not on Mac, instead of using Apple PI Baker just format the card and use FAT32 as file system. If for some reason you don't want to use PINN (e.g. you don't have a monitor to install the OS on your Pi) you can use official Raspbian image right away.

Plug the SD card into your RPi, connect keyboard, mouse, monitor and power it up. In PINN interface select Raspbian and install it

BTW, if you have several RPi's laying around, you can chose the least powerful one, as this project does not require a lot of processor power. I'm using 1st gen RPi myself.

Enabling GPIO DAC

I use cheap chinese DAC from Aliexpress which in my opinion sounds just great.

You can find instructions on how to wire it up on this link, but as we don't use Volumio, you'll need to perfoem some extra actions to make it work

Let's edit the config

sudo nano /boot/config.txt

and uncomment/add these lines

dtparam=i2s=on
    dtoverlay=hifiberry-dac

and comment this one

# dtparam=audio=on

Installing AirPort clone

We need to install Shairport-Sync (not to be confused with Shairport which is outdated) to be able to stream audio from Apple devices to our PI. GitHub has quite detailed instructions on how to build it, but here is simplifed version just for PI

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

Building SOXR

git clone git://git.code.sf.net/p/soxr/code soxr-code
cd soxr-code
./go
cd Release
sudo make install
sudo ldconfig

Building Shairport-Sync

cd ~
git clone https://github.com/mikebrady/shairport-sync.git
cd shairport-sync
autoreconf -i -f
./configure --sysconfdir=/etc --with-alsa --with-pa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd
make
sudo make install
sudo systemctl enable shairport-sync

Adding on/off button

I think I can't write instruction any better than this article