New version of Shairport with Audio Synchronisation

Hi there. I’d like to announce Shairport Sync, a version of Shairport with audio synchronisation.

This new version of Shairport – “Shairport Sync” - adds audio synchronisation: the audio output stays in sync with the source and with other AirPlay devices – it doesn’t drift in and out of sync, so it’s good for multi-speaker or multi-room audio. It has a few other improvements too – overall, it’s a bit more “housetrained”. It is for Linux only and requires ALSA and avahi to be installed.

Built and tested on Ubuntu, Raspian and OpenWrt with a variety of USB audio output devices – an original iMic, a “3D Sound” card, a Topping TP30 amplifier, the Raspberry Pi’s built-in sound card.

At this stage, it seems pretty robust. I’d appreciate any feedback.

It’s at: github.com/mikebrady/shairport.

(If you’re installing it over an existing shairport, please note that the options are different – some are new and some are no longer recognised.)

I am giving this a try, I really appreciate what you did! This seems quite awesome and furthermore very well documented. If it proves to be robust and fulfill the requirements of Volumio, I will be more than happy to integrate it!

Mike,
succesfully compiled and installed. If I make it start with its init script, it works flawlessly. However, I need to start it via custom shell script. What I have with the command:
shairport -a “Shairport 2.0” – -d hw:0

is:

Can’t set the D/A converter to 44100 – set to 48000 instead./n

What do you think?

In the script above, you’re asking Shairport to use device hw:0, which doesn’t support the 44100 frames per second rate needed – it reports that the nearest frame it can support is 48000. However, if Shairport is working flawlessly in the init script, then it may be that you have more than one sound device on your system, and that a device other than hw:0 is the default. Does that seem possible? Try just:

shairport -a “Shairport 2.0”

See what happens…

Yes, with that it works. The problem is that I need to change output device accordingly with the user selected one… So, guess we can omit the hw, and use just 0,0 . What is the syntax?
Original shairport didn’t have this problem, with the same device. Can a on the fly resampling be applied?

That’s good! I don’t know what the exact rules for the syntax are. You can say -d default or -d hw:0 or -d hw:1 etc. This has been the case for all linux systems I’ve tried. I used alsamixer to discover the names to use.

Regarding the resampling, AFAIR that feature wasn’t available (or not enabled) in the previous version of Shairport that I started with on OpenWrt. I wanted to focus on getting synchronisation working well, so I was happy to disable it, as it complicates the timing calculations somewhat. Now that Shairport Sync seems (!) to be reasonably stable and robust, one could reintroduce it, but it won’t be too soon, I’m afraid.

does it work with devices like the Wolfson audio card for the raspberry pi?

Thanks

Dave

Bumping this, since I have been using Shairport Sync for a few months now, and it is far better than the original Shairport. @Michaelangelo did you ever manage to get this working with Volumio?

Is alreay included and working in Volumio2 :wink:

That profile picture is exactly how I imagine you looked when writing that :slight_smile: