The Raspberry Pi is a great little computer that provides a device to do little projects on.
In this tutorial, I’ll show you how to set up a Raspberry Pi to be used as an AirPlay receiver so you can stream audio from any iOS device, iTunes or compatible AirPlay software.
You’re going to need a few things before we get started.
- Raspberry Pi (I’m using the Raspbian OS]
- 4GB (Or larger SD card)
- Power Adapter (Micro USB)
- Display & Keyboard (or set up SSH)
- Ethernet Cable
We want to make sure that the Pi’s software is all up to date by entering the following into the command line:
sudo apt-get update
sudo apt-get upgrade
The first, sudo apt-get update , checks for any new software packages. The second, sudo apt-get upgrade, downloads and installs the software packages that are available.
Installing Additional Software
Now that the Raspberry Pi is up to date, we need to install additional software that isn’t included as standard. This software will help us set up the AirPlay receiver:
In order to continue we will need to install those software packages, so let’s install them.
Installing Software Packages
To install the software packages, we’re going to use one huge command:
sudo apt-get install avahi-utils build-essential chkconfig git libao-dev libavahi-client-dev libcrypt-openssl-rsa-perl libio-socket-inet6-perl libssl-dev libwww-perl pkg-config
As soon as you enter that Raspbian will begin to download all of the files necessary.
Now we will need to download a piece of software called ShairPort. This is the core piece of software that will allow us to stream audio to our Raspberry Pi. Just to make sure we’re at the right place in the directories type cd into the command line and we will be ready to continue.
We can now use one of the pieces of software that we previously installed called git to download ShairPort from GitHub.
git clone -b 1.0-dev git://github.com/abrasive/shairport.git
This will then download the ShairPort files that we need, so once it has completed the download type the following into your command line:
This will take you to the ShairPort folder which you just downloaded. Now we are going to prepare ShairPoint for install and then we will install it.
sudo ./configure && sudo make && sudo make install
After that has completed ShairPort will be ready to go.
To start ShairPort, enter the following command:
shairport -a ‘Not Apple Pi’
This will start the ShairPort server. I decided to call it Not Apple Pi but you can call it whatever you like. Our Raspberry Pi will then state that it’s “listening for connections” which means it’s ready to go.
I’ve opened up the AirPlay menu on my iPod, and you can now see that the Raspberry Pi, titled Not Apple Pi is in the list. To test it out, simply start streaming some audio to it and plug in your speakers or headphones.
If you have HDMI and a headphone jack plugged in the Raspberry Pi will play through the HDMI instead, so unplug the HDMI and reboot the Raspberry Pi, then run ShairPort again.
Adjusting the Volume
Hopefully you should have some audio playing through your Raspberry Pi.
If the audio is a little quiet you can boost it. Firstly pressing Ctrl+C will stop ShairPort and then you can enter the following command:
Then using the up and down arrows you can adjust the volume levels. I’d recommend around 75-80, otherwise your audio may become distorted.
Press Esc to save your changes and quit and then run the ShairPort starting command again.
The quality through the headphone jack is not great but acceptable, and you get better quality through HDMI. But it’s a cool thing that you can set up in just a few minutes so you can stream audio to your Pi.