Multi-Room Music Sync

Hi All,

I’ve requested this from Kodi devs and in over a year ago and no movement (apparently it’s pretty hard to do).

The request: Start music from within OSMC and have a “sync to” option that lists all active Kodi machines - giving an ability to check all (or less) and then OSMC as well as those other Kodi boxes would simultaneously play the content.

Why: Super useful for multi-room setups (think hosting a party and have a Pi outside and inside playing music)

See also:

Thanks for the awesome product.

1 Like

Also very interested in this as I currently have a .strm file loaded (sourced/smb://192.168.blah.blah/network shared file) on all Rpi units. Stream the audio locally from VLC “open capture device”

I then use the web ui (osmc)with 6 open tabs to manually start the stream.

My obvious issue is with synchronization of all the Rpi’s. I honestly have no idea how to sync the playback. Black burst? Time code? Help?

LMS (Logitech Media Server - ex SqueezeCentre ex …) can sync players - so you might find that you can do this with XSqueeze add-on.

I do this with iTunes, I enable AirPlay on all my devices (Or is it enabled by default?) and then from iTunes I can select which rooms and which volumes I want it playing.

Hi All,
I should have said that I know of the alternative ways to do this but I think a built in method would be superior. I have zero interest in ever having an apple product in my home so iTunes and iBlah (joke) methods are not available. As far as LMS - I’ve used this before, it’s okay but still not super clean (and entirely unavailable on low end machines like RPi 1).

I think a build in system that detects all running Kodi machines and just gives a simple list with the ability to add check marks to the systems you want to push to would be substantially better.

Should also note that there was quite a bit of interest on the Kodi thread that I started so I think that it would give OSMC the ability to stand out a bit more :slight_smile: Even Kodi developers seemed interested but ultimately said it was just too hard to do perfect, so apparently they didn’t do it at all. I’d be happy to have a less than perfect solution (if there is a slight latency issue…so be it, it’s better than no option at all).

The problem is, Kodi has far more resources than OSMC, even when it comes to simply maintaining the code as it exists and bringing improvements on a timely basis that benefit the largest majority of users. Even with all their resources, nothing came of it. I can assure you that OSMC has far fewer resources and time to dedicate to something even if the acceptable solution is less than perfect.

PulseAudio support is used for Bluetooth audio in OSMC. PulseAudio supports RTP multicast streaming, so in theory, this would work relatively out of the box already, if you install the A2DP testing software. I’m not sure how synchronised the audio would be though. I think that this is why products like Sonos have such a market share.

I totally understand the nature of the request and the realities of both this project and Kodi. Just figured I’d bring the request over here to share it and see if there is any interest.

If I find some time I’ll check out A2DP. Thanks all

I’m not an expert.
But… there should be any solutions for it.

When remote controls like Yatse can know the current playing file and time code.
Why not take an 2nd pi and write an small script that check every x second what is currently playing.
When something is playing, the script can get the file from the nas or else and play it. Now the script only need to skip to the time that is currently on the kodi.

Only an idea… but can that work?


The problem is the clocks in the separate Pi’s (or any audio playback devices) are not synchronised.
Clock accuracy (from the crystal oscillator) means they may drift by about half a second every hour.

If you are standing in the doorway between two rooms playing the same file that audio offset will be very disconcerting.

Devices like sonos have a PLL adjustment on their clocks to force the devices to be synchronised to <1ms to allow multi-room audio to work well. They are expensive though.

Technically the Pi can do this from a hardware point of view, but as there is no standard API for achieving this across different platforms, upstream kodi will never support this.

You can get a similar effect from resampling the audio by very small factors (e.g. 0.01%) but that would probably upset the audiophiles. But in theory that scheme could be handled in a platform agnostic way and could be implemented by upstream kodi.

1 Like

See the thread in here I am suggesting to evaluate snapcast which could bring multiroom audio to osmc.

While I understand the logic of initially thinking “I have multiple OSMC/Kodi/etc., it would be nice if they could play in synchronicity”, I do not think it is a good approach to OSMC multiroom, especially for music.

First, it is a waste of computing resources. The music file only has to be decoded once, then it can be broadcasted as PCM to every room you want to play it. Why decoding it in each room using separate instances of OSMC?

Second, it is a waste of hardware. While a computer like a Pi is fairly cheap, it still means you need a full computer in each room and if it’s headless, you will have to bring a screen and a keyboard every time you want to change the configuration, which is a pain. Plus a Pi is still more expensive than a simple Bluetooth receiver with AptX or an equivalent over Wifi if you want lossless music.

Last, but not least, trying to use multiple instance of OSMC to playback the same music with a latency low enough that it is imperceptible is opening a Pandora box. First, you have to calibrate the network latency to make sure that each time you send a synchronized playback command, each instance start exactly at the same time independently of the network latency, and you have to repeat the calibration each time you start a new song because the latency of a network is not constant. Then you have to calibrate the clock speed of each OSMC instances to make sure that a song that start synchronized doesn’t become desynchronized after 5 minutes (a synchronization message at regular interval is even more complicated because you have to recalibrate the network latency before every synchronization message). Then, since none of the OS used by OSMC are real-time OS, you have to take into account that a process on one the instance may delay the playback, so each instance will have to monitor its playback clock, detect the delay, signal the other instances which all have to play catch up for a while until they eventually resynchronize.

I am not saying it is not feasible, one of my client have just done that with Android TVs but, to give you an idea of the complexity, a team of developers had to rework the Android OS for 3 years before they could make it work reliably. And that’s just one OS. The OSMC and Kodi Teams would probably have to develop custom versions of Android, Linux, Windows and MacOS to make it work, and redo it again each time one of those come up with a new OS.

So why opening a Pandora box when, in fact, OSMC multiroom for music already exists, is cheap and more practical than using separate instances of OSMC: Simply use AptX receivers or Wifi receivers if you prefer lossless music. Basically, all you need is to make sure your Kodi computer has bluetooth, plug the Bluetooth or wifi receivers in the sound systems or amplified speaker of each room, including the room where you have OSMC and pair them with OSMC as the master so it can be paired with multiple receivers. When you want to listen in an additional room, just switch on the sound system in this room, make sure the source where the Bluetooth or wifi receiver is plugged in is selected and they’ll start playing whatever OSMC is playing. It’s that simple. And if you are not in the room where the Kodi computer is, just use the Kore or Yatse remote.

Now, movies are another story. However, I don’t think there is many people who really want to listen to the same movie in different rooms at the same time. For movies, what would be useful would be to pause a movie in one room and resume watching it in another room. And that’s much simpler to implement since it doesn’t require any form of synchronisation; only one instance of OSMC is playing at the same time. And for that part, I don’t understand why it was not already implemented when OSMC and Kodi were called XBMC, considering how easy it is (as long as you accept that one instance of OSMC is the master and will be on 24/7, but a Pi doesn’t use that much electricity when OSMC is idling).

Thanks for guidance about it its really acknowladgeable thread.

IMO, bluetooth is totally not the way to go here…

On the volumio (music player linux build) forums i found something interesting…
This guy is building a service that can stream any ALSA source (kodi, mdp, spotify, whatever the OS throws at it) and do synced streaming to squeezebox players (also kodi / volumio)

When & if this starts to be functional… (which i hope will be soon) This would be awesome to have integrated into OSMC / KODI / Volumio…

This is what i’m talking about:

1 Like