Kodi Community Forum

Full Version: Airplay music not in sync with other airplay targets on XBMC
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I've checked with RC2 on both ATV2 and Mac OS 10.6.8, but when I send Airplay audio to them they are a bit behind the Apple approved Airplay targets (Mac OS 10.7.3 with iTunes 10.6 sending to itself as well as Airport Express boxes). I remember Airserver having the same issue in the beginning and fixing it (Airserver on the same Mac OS 10.6.8 target is in sync with other targets and source)

Currently, XBMC is behind the others. I can't check if the XBMC's are in sync with eachother as they both only have digital audio out and are connected to the same tv and I have no external DAC.

Does anyone else play music to multiple Airplay targets that is experiencing this issue with XBMC?
Not supported and a known limitation for XBMC atm.
fair enough. Does this "bug" have any priority or is there no interest in fixing this one (relative to other things that can be worked on)?
Any updates on this? I love the new airplay features but without sync it is not really a replacement for airport express / appletv yet.
AirPlay features come from reverse engineering AirPlay itself, since this is all undocumented and no one knows how to do this except Apple. It takes time and effort to find these things, as well as a lot of detective work. It's like taking a car apart to see how you can build another one, without knowing how it originally worked. Except this car also has a lot of parts that are hidden and locked under the hood.
NedScott thanks for your protection. But in that case i have to mention that this sync stuff is very well documented. (from others who already did the reverse engineering). Though its not fitting in our Audio Processing stuff and i'm just not willing to work on it. (because i just don't care about that feature) Smile. Sorry guys - it needs another dev for this.

I'm working towards factoring all that airplay stuff out into an python addon - i guess it will get even harder to get the audiosync in with that step. But there is one player out there which implements the audio sync with airtunes - IIRC mythtv can do it.
I was just looking at this ... I have three airport expresses and two xbmc boxes ... It would be great if I could get them to be in sync ...

*I'm going to do some googling but if anyone has the airplay documentation (especailly anything about the sync part) I would love a link

Edit: Here is the link: http://git.zx2c4.com/Airtunes2/about/
Another Link: http://blog.technologeek.org/airtunes-v2
Hei guys! You're gonna love this.

I'm runing AirfoilSpeakers for ubuntu and sound perfectly synced with the rest of my configuration (airport express and another pc).


I'm using Xbmcbuntu Eden, I had to install some mono dependencies (the ones that the airfoil speaker installation demands) then the airfoilspeaker for ubuntu 32 bits.

Then you have to export a mono variable (to avoid some weird crash when the program is running for a while)

export MONO_PATH=/usr/lib/mono/4.0/;

and last run


You always can automatize the export in some rc.local file and run airfoilspeakers as a daemon with the start of the session!

Only works with Airfoil Server (not itunes right now)

This made my day! and you now what? there is a version that works for ARM too so... I'll have now my own home disco with a lot raspberry pis all over the place. (Much cheaper than the airportexpress option)

Bye and enjoy.

Digging this one up from the grave because I just started experiencing this issue. Airplay seemed to be synced fine with my other apple speakers (airport express, apple tv) running Eden XBMCbuntu. This weekend I upgraded to Frodo and now the XBMC target is noticeably behind the other targets. Has anyone else experienced anything like this?
(2013-03-25, 14:29)grammo Wrote: [ -> ]Digging this one up from the grave because I just started experiencing this issue. Airplay seemed to be synced fine with my other apple speakers (airport express, apple tv) running Eden XBMCbuntu. This weekend I upgraded to Frodo and now the XBMC target is noticeably behind the other targets. Has anyone else experienced anything like this?

Yup I have this problem too. I airplay from my iTunes running on a desktop machine to both my iHome iW1 and XBMC running on windows 7 with Frodo and the XBMC lags behind the iW1 all the time.
Xbmc doesn't Support synced Audio Playback - See Feature request Forum before stating "can't be that difficult" ;) (ohh and it Never did - if it "worked" in Eden - then by accident)
It seems that XBMC will change from the shairport to the shairplay library in Gotham, but for Frodo they are using shairport. I've got an old Apple TV (first generation) that I recently installed Crystalbuntu 2 on. They have a tutorial for installing shairport seperately so you can use the ATV as XBMC for your screen and use the analog output as an Airport Express.


That works, but also has the timing issue. However, that can be solved:


Which makes me think the same is true for the build-in airplay support in XBMC Eden/Frodo. However, in the OS X XBMC.app or the Crystalbuntu linux install, I couldn't find any shairport/hairtunes files seperately (my command line search capabilities may be at fault), but in the source I, of course, did find a number of references, but they were to libshairport and libshairplay.

I think we'll simply need to get a developer to write a patch and lobby for inclusion that will allow a buffer change in the configuration for Airplay. While I do feel that the implementation "can't be that difficult" relative to getting airplay to work in the first place, I think that getting our niche issue heard and acted upon is difficult. Big Grin
Yeah that too - but your assumption that it can't be that difficult is just wrong ... just read up here:


The solution you linked is plain wrong too and only works by accident. (you will realise that once you have read through the posts i linked you to).
Thanks for responding Memphiz. I agree that multi-speaker sync'd audio is hard to code (although there are a number of solutions that work, even multiplatform, like airfoil), but the nice part of it is that as far as Airplay is concerned, all the hard parts are done on the side of the Airplay sender, not the sink. Especially audio is standardized, it's simply 44k1/16bit apple lossless. Encoded by the sender.

The major timing factor on the sink side (in this case, XBMC) is how much to buffer before you start playing. And that's exactly what you can influence. It's clear that the default is not working for most people, hence the complaints/feature requests. Now, I understand that there are way too many different systems that XBMC runs on (even within one platform) to have a setting that will work for everyone. However, if you allow the buffer to be changed, everyone can, if they care, change it so it works for them.

And indeed, sometimes, because of a hiccup somewhere audio gets out of sync. In which case you simply remove the speaker momentarily and reconnect, making the sync work again.

Now, I'd love for XBMC to use remote speakers (Airplay targets amongst them) and have it work like on ipads and macs, where the sound on airplay speakers is in sync with the video on the screen, or even having an airplay target for a screen and other airplay targets for the audio and it all being in sync (or other tech to transfer video/audio), but that is a major undertaking, as far as I can see.

Memphiz, I understand you don't feel that changing the buffer size is a proper way to influence the timing, but would you be willing to look into the possibility of adding that option in the (advanced or expert) airplay settings now XBMC's move to the shairplay library? If it's at all possible, there's many of us willing to experiment a bit just to try and get better results than we're currently getting.
Nahhh thats not the right way to do it and i am not familiar with our player framework for finding all the buffers which are involved.

And of course the sync in the airplay protocol is something which has to be handled well on the sink side (its not only the airplay sender handling all this - it can't the clocks on the different devices are not in sync...). Regulating the buffer is not working in most cases. Just do what i stated in the other thread. Take 2 systems and play the same 8 mins song on both of them (trigger them by hand and start them in the very same second). Its hit and miss if both will be in sync after 7 mins. Its an unhearable difference in playback speed which is the real issue (caused by different internal clocks). And that is nothing you can handle by adjusting the buffer size.

For the sync protocol in airplay (and its complexity) - have a look here:


Even if libshairplay would implement this protocol it would need a lot of work to interface that with XBMCs audio player. ATM there is no one stepping up from inside the team for investigating that workload. So if nobody from outside does it, this will not happen for now. And first of all - the support would have to be implemented in libshairplay first - which is not developed by TeamXBMC but has its own unrelated upstream developer.