Adding Airplay/Shairport to RPi Bridge

I have a Raspberry Pi 3 (with a HiFiBerry Digi+ and running Jessie Lite) which runs RoonBridge and feeds my DAC via optical S/PDIF.

All works well, no problem.

I would however like to add the option to send audio via Airplay to the DAC via the RPi.

Is it possible to have both the Roon Bridge and Airplay working together? The RPi has a 32Gb card in it so there is lots of space.

If so, what is the simplest way to install this? I have had a go at adding Shairport (via the command line; following [this guide] (http://raspberrypihq.com/how-to-turn-your-raspberry-pi-into-a-airplay-receiver-to-stream-music-from-your-iphone/) although I could not get it to work properly.

I was able to get the RPi to appear on my Mac (via Airplay) but it would not work stating that something else presumably the Roon Bridge) was using the audio.

How does Shairport and Roonbridge decide which ‘gets’ to use the RPi audio output (if both Roonbridge and Shairport want it)?

I confident in using the terminal etc. but baffled by how Linux actually works - ‘services’, ‘init’ ‘dependencies’ etc

Thanks in advance

Doug

Edit: The reason why I want to do this is to send the output from Spotify (running on my MacBook) to my audio system.

Gosh! No replies, I can’t be the only one wanting to integrate Roon and Airplay, how are others doing it?

D

You will want to run shairport-sync: https://github.com/mikebrady/shairport-sync

I’ve tried it a few weeks ago – worked fine. Access to your audio is on a ‘first come, first served’ basis, but since both Roon Bridge and shairport-sync release their grip after playing, they work quite well in tandem.

If your use case is Spotify only, you can also look at adding Spotify Web Connect: https://github.com/Fornoth/spotify-connect-web

1 Like

Rene

Many thanks for this, I can see this would solve my problem. Unfortunately quite a lot of what’s in there I don’t understand - making installation much harder. Linux is brutally unforgiving if you don’t know what you are doing!

I wil search around to see if I can find a step-by-step installation guide though (now I know what I’m looking for!).

Doug

Alternatively, you could use DietPi (a minimal Raspbian distribution with an easy-to-use software installer) instead of the official Raspbian Jessie Lite distro. You can install, config and run dietpi-software to install shairport-sync.

Afterwards, install Roon Bridge using the easy installer from Roon. I have not tried this, but I can see no reason why it wouldn’t work just fine.

Rene

Thank you again! I think I’ve now done it - as you suggested using DietPi.

It took a little trial and error (DietPi is an interesting approach)!

Many many thanks

Douglas

I’m running RoonBridge and Shairport-Sync. As you say it works on a ‘first come, first served’ basis i.e. whatever is playing cannot be interrupted.

However, if I set allow_session_interruption=yes in shairport-sync.config then this happens:

  1. If an Airplay device is playing then another Airplay device can interrupt and start playing.
  2. If an Airplay device is playing then Roon cannot interrput - gives message “Failed to open the audio device”
  3. If Roon is playing then Airplay device cannot interrupt Roon

Is there any setting in RoonBridge that allows it to be interrupted?

Mike

1 Like

Not that I know of – and I think it is highly unlikely to appear. In order to do what you want, RoonBridge would need to listen to requests from a different protocol to release the soundcard.

While it’s convenient the two can co-exist somewhat peacefully, this may be overreaching (it would need to be a setting as well: not everyone would want their RAAT-stream open to interruption by anyone with an iOS device ;-)).

Stopping one stream before starting the other is as good as it gets, I think. But then again – who am I?

Makes sense - Shairport-Sync is (presumably) only listening for Airplay requests.

I’m content with how it works at the moment - useful that the two can co-exist - jiust thought I’d ask in case there was some way of allowing ‘mutual interruption’

Thanks,

Mike.

PS. I think Roon is wonderful - just bought a lifetime license - even though it probably means throwing away (selling?) my Sonos kit.

You may want to hold off on selling your Sonos gear for a little bit longer… Little birdie sometimes whispers funny things (see 2nd post by @danny):

I wouldn’t go that far… you can get a better experience with raspberry pi + iq audio or hifiberry for the same price you can probably sell your sonos for…

if you need the sonos for sonos, keep it… otherwise, trade it in :slight_smile:

1 Like

While I fully vouch for the Pi (I use one with a Hifiberry Digi+ Pro in my main rig, and one with an IQ Audio PiDAC+ In my headphone setup), they don’t replace a PLAY:1/3/5 tucked away in the kitchen that handily… :wink:

Sonos with Roon would only be useful (from my viewpoint anyway) if it was via RAAT - my two main listening rooms have speakers fed by computers (Mac Mini and MacBook Pro).

I’ve tried Airsonos. Works fine (although has to run on Mac Mini, Raspberry Pi wouldn’t cope with playing to more than 2 sonos speakers). The latency is a problem and you can’t group the Airplay speakers with RAAT endpoints.

I’ve also tried using the analog input of a Sonos connect - fed by a Raspbery Pi running RoonBridge - to send to other Sonos speakers. Works OK - and, because the RPi is a RAAT device, it can be grouped with other RAAT endpoints - BUT, unless you have 1 Sonos Connect for each Sonos Speaker, then you have to group speakers using Sonos app. Fiddly. Also means that signal is going through lots of conversions (D->A in RaspberryPi, A->D in Sonos Connect, D->A in Sonos Speaker).

So I’m going to set up a number of RPi endpoints and buy / make speakers for them. This will give Roon RAAT + Airplay for all speakers. Means that guests with iPhones can, for example, just play to one of the speakers using Airplay.

Sonos kit maintains it’s proce well (I can sell Play 1 for £130 - cost £165 new) so sale of Sonos kit will fund RPIs+DACs+Speakers.

Bet that, once I’ve done that, you will announce Sonos integration in Roon as RAAT endpoint. Even if you do, though, I’ll have had fun setting it all up and will have much more control over how it all works!

2 Likes

there is like zero chance that sonos will work over RAAT… for them, we are tiny in terms of userbase, and they don’t care about quality.

our sonos integration will be a wedging stuff into their upnp mechanisms.

Thanks - that confirms what I suspected.

I’ve already got a potential buyer for some (most) of my Sonos kit - the proceeds will fund Raspberry Pies, Dacs and speakers to attach to them!

3 Likes

Pretty straightforward, just a lot of instructions to wade through on the Shairplay-sync page. I’m using a Rasberry Pi 3 and Hifiberry.

###Install dependencies

apt-get install build-essential git autoconf automake libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev

###Download Shairport-Sync

git clone https://github.com/mikebrady/shairport-sync.git

cd shairport-sync

###Configure

autoreconf -i -f

./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-systemd --with-soxr --sysconfdir=/etc
make

###Configure systemd system and audio user

getent group shairport-sync &>/dev/null || sudo groupadd -r shairport-sync >/dev/null

getent passwd shairport-sync &> /dev/null || sudo useradd -r -M -g shairport-sync -s /usr/bin/nologin -G audio shairport-sync >/dev/null

To install shairport-sync along with a man page, a default configuration file and a systemd configuration file called shairport-sync.service:

sudo make install

To launch it automatically at system startup:

sudo systemctl enable shairport-sync

Edit /etc/shairport-sync.conf to have the following:

general =
{
        name = "My Airplay Device";
        interpolation = "soxr";
};
2 Likes

Very belatedly - just came back to this thread - big thank you to Leon_Roy - your install guide worked without a glitch.

D

Just came back to say thanks Leon_Roy and bookmark this page for future instalations! :smiley:

Very welcome all.

Here are the instructions for keeping shairport-sync updated thereafter:

Upgrading Shairport-Sync

From the shairport-sync directory you pulled down using git clone:

git pull
autoreconf -fi
./configure --with-alsa --with-avahi --with-ssl=openssl --with-metadata --with-soxr --with-systemd --sysconfdir=/etc
make
make install
sudo systemctl daemon-reload
sudo systemctl restart shairport-sync
1 Like

@Leon_Roy. Are you using the Hifiberry Roon Bridge image, Dietpi, or Jessie? Because it’s not working for me with the image from Hifiberry. Is there a way to add shairport to the hifiberry roonbridge image?