AirPlay Audio Server

AirPlay support in Kodi is hit and miss (nothing appears to work with iOS10). These instructions will get an AirPlay audio server up and running on OSMC using the excellent shairport-sync package from Mike Brady (GitHub link). Most of these instructions are covered in his file, but I got confused with Linux audio – this write-up covers all steps in the setup in one place.

This is tested and working on a Raspberry Pi 3 running OSMC (2016-10) and iOS 10 devices. AirPlay audio is output from the 3.5mm jack on the Raspberry Pi, which can then be connected to an external speaker (I use the aux input on an old Bose SoundDock).

Firstly, if you have AirPlay enabled from within Kodi, disable it (Settings > Services > AirPlay).

The shairport-sync package is not available in the main Debian Jessie repository, but it is available in the Jessie backports repository. Apparently it will be included in the main repo for the next Debian release. So, you need to add the Jessie backports repo to OSMC:

sudo nano /etc/apt/sources.list

Add the following line to this file at the bottom:

deb jessie-backports main

Run sudo apt-get update to refresh the package lists.

Important: Per Sam’s comment below, remove the backports repository from your sources list once you have finished the installation process.

Then install shairport-sync:

sudo apt-get install shairport-sync

Configure shairport-sync:

sudo nano /etc/shairport-sync.conf

Edit this file so that the following parameters are set (un-comment the lines as required):

name = “Your Airport Server Name";
drift = 352;
volume_range_db = 30;
run_this_before_playback_begins = “/usr/bin/amixer cset numid=3 1”;
run_this_after_playback_ends = “/usr/bin/amixer cset numid=3 0”;
wait_for_completion = “yes”;
output_device = “hw:0”;
mixer_control_name = “PCM”;

Enable and start the shairport-sync service:

sudo systemctl enable shairport-sync
sudo systemctl start shairport-sync

You should now see a new AirPlay target called whatever you named your server, and AirPlay audio should be output from the 3.5mm jack.

A couple of other notes:

  • If you want to stream from your Windows PC you can install TuneBlade, which is free to use when streaming to a shairport device. Note: Version 1.8.4 of shairport-sync is incorrectly recognised by TuneBlade as a genuine AirPlay receiver, as a result TuneBlade will only operate in trial mode. To fix this you need to install shairport-sync 2.8.6. However, 2.8.6 is not yet in the backports repository so you need to build it from scratch using the instructions at the shairport-sync GitHub page.
  • If you want AirPlay audio to come out of HDMI instead of the 3.5mm jack, don’t add the run_before_playback_begins, run_after_playback_ends and wait_for_completion lines to the config file.
  • You can plug a standard 3.5mm stereo plug into the Raspberry Pi 3.5mm socket to get audio out (i.e. there is no need to use a special 4-pole jack and adapter).

Remove the backports repo after or you have a nice paperweight when you update

1 Like

Thanks for the tip - I’ll do that.

I’m on a Vero - do you maybe know how I can identify the audio hardware IDs to set shairport-sync to always play via SPDIF?

aplay -l should list it

Let me know if you need a hand

Hmmm… aplay is not installed (command not found)?

sudo apt-get install alsa-utils?

Hey guys, this is of great help, thanks!
One question though, any idea how to make sound output both on hdmi and jack ?

Setting:system:Audio, Audio putput device

choose “both hdmi and analauge”

Unfortunately this option applies only for audio content provided by Kodi, not for airplay content through shairport-sync

It sounds like the service isn’t starting properly. You are probably best to start an issue over at the developer’s GitHub page (see my OP for the link) and see if someone can help over there. I think there are troubleshooting tips on that site as well that might help.

Why is this the case?

I think it is just to speed up the “apt-get update” in the future. I kept it in.