AirPlay on Raspberry Pi - Shairport Sync
AirPlay is a great feature built directly in to iOS / macOS allowing music streaming to speakers and video streaming to Apple TV’s.
There are two ways to install ShairPort-Sync via the command line or the Raspberry Pi GUI. This depends on the version of Raspbian you're running.
AirPlay speakers or an HomePod can be expensive if you’ve already invested heavily in to audio equipment. As long as your audio equipment has an AUX port you can use a raspberry pi to supply wireless music to it and play it loud.
You don’t need expensive speakers or audio equipment, just a pair of powered speakers will suffice, a Aux in cable that’s either 3.5mm to 3.5mm or RCA to 3.5mm. Now the full size Pi’s have a headphone jack, the smaller Zero series will need a HAT on top to output the sound, I’ll cover one of those in the future.
Raspibian Install - Via GUI
If you have the desktop version installed add ‘AirPlay Audio Server’ from the Add/Remove Software packet manager. It does all the hard work for you.
Once installed, reboot and search for the Pi on your Apple device under the AirPlay icon.
Audio sound level control can be done via the volume settings on your device.
Raspibian Install - Via CLI
sudo apt-get install shairport-sync
Once the installation is complete, you can start Shairport-Sync by executing the following command.
sudo systemctl start shairport-sync
To autostart shairport-sync on reboot or startup run the following command, and its done.
sudo systemctl enable shairport-sync
Start Playing Music
Whatever your Raspberry hostname is, this is what the AirPlay Speaker will be displayed as. In my case ‘PiedPiper’
Starting and Stopping
To Start
sudo service shairport-sync start
To Stop
sudo service shairport-sync stop
Other Tweaks
Checking shairport-sync status.
sudo systemctl status shairport-sync
You’ll see active or inactive in the active field.
Checking the Audio Levels via Terminal or SSH run the command
alsamixer
Which opens up a display showing the current volume level, which can be adjusted using the up and down keys on your keyboard.
ESC exits the CLI Program.
If things get a bit sluggish or buggy, you can use HTOP to find out what’s going on.