in Tech

Turning a Raspberry Pi Into an Airplay Receiver in 10 Minutes

Raspberry Pis are pretty great little devices.  For $35, you get a quad-core ARM CPU with 1GB of memory.  Well, $35, plus a case, and power supply, and a USB cable if you don’t have one lying around, and then a micro-SD card to boot from.  Really, just get a kit.

I listen to a lot of music, and have a lot of speakers in my house.  I vastly prefer AirPlay over Bluetooth for connecting to speakers.  I can walk anywhere I have wifi reception, and pairing multiple devices isn’t a problem.

You can turn a Raspberry Pi into a high-quality Airplay receiver super, super easily.  Most of the information on the Internet is out of date, so here’s a guide, starting with a fresh Raspberry Pi.

SD Card Prep (Minutes 0-1)

Download “NOOBS Lite” and put it on a freshly-FAT32-formatted SD card.  If you’re on macOS, and it’s being weird and dumb about formatting, just use the official SD Association’s format tool.  Yes, such a thing exists.  We live in strange times.

(Alternatively, if you have a Synology or similar NAS in the house, and would rather your Pi’s “drive” live on a robust storage system–which you should–you can use BerryBoot to set up iSCSI with a nice GUI.  They have a Synology-specific guide, too.  The BerryBoot lite version is behind, so install the full Raspbian)

OS Install (Minutes 2-5)

Boot your Raspberry Pi with NOOBS/BerryBoot, connected to a keyboard/mouse and an HDMI monitor.  This is all temporary.  These little keyboard/mouse wireless devices are great for this sort of stuff.

Install Raspbian Lite.  You don’t need a GUI here, and it’s smaller.

Configuration (5-10)

Once Raspbian Lite boots up, log in at the prompt (still on your physical keyboard/monitor).  The default login/password for Raspbian is pi/raspberry.

Enable SSH / Set the Hostname

Bring up the built-in configuration tool by typing:

sudo raspi-config

Enable SSH for later access (under Advanced Options -> SSH), and set the hostname for the machine (under Advanced Options -> Hostname). This will also be used as the default Airplay name.

If you don’t have an easy way to dig out DHCP assignments on your network, check the Pi’s IP by typing ifconfig.  I hardwire all my Pis on ethernet, but they should be fine on wifi too.

Configure USB Audio

You shouldn’t use the built-in audio jack on a Pi.  It’s garbage. Instead, you should buy this $20 USB DAC, which is great.  It spits out both RCA and digital optical.

However, Raspbian won’t automatically use it.  You’ll need to change the priority of the audio devices by adding an ALSA config file (this is where enabling SSH comes in handy, because by now you should be doing stuff over SSH and can easily paste to the Pi):

sudo nano /etc/modprobe.d/alsa-base.conf

Then, once you’re editing the file, and/or chiding me for using nano, the file contents itself should be:

# sets the index value of the cards but doesn't reorder.
options snd_usb_audio index=0
options snd_bcm2835 index=1

# does the reordering.
options snd slots=snd_usb_audio,snd_bcm2835

(Ctrl-X to exit nano, or whatever arcane invocations are required to save and quit from vi)

Install Shairport-Sync

This is the actual software that emulates an Airplay receiver!  Most of the information out there on installing it is old.  It’s built into the package repository these days, so just type:

sudo apt-get upgrade
sudo apt-get install shairport-sync

That’s it!  You should have an Airplay receiver up and running.  The shairport-sync config file is at /etc/shairport-sync.conf if you want to change the speakers’ name or muck around with other settings.

TL;DR:  install raspbian; apt-get install shairport-sync; configure USB audio priority

Write a Comment



  • 1: Yet another Raspberry Pi Airplay hack (w/ Pulseaudio benefits) | t(h)inker thots

    […] Airplay was the best option for me cause of the iOS devices at home (and great tutorials here and here). In addition, I was able to route audio from my linux box via Pulseaudio (accidental discovery.). […]