[chuck-users] syncing computers with OSC

Mark Pauley pauley at unsaturated.net
Thu Jan 29 18:34:09 EST 2009

So my thoughts:

a) for sync just use UDP, if you miss a sync message, who cares.  Sync  
should really only be used to nudge the tempo's back together.  Just  
ignore any sync messages that come out of order, you'll save bandwidth  
once you start syncing a bunch of computers.
b) to get a handle on the latency (which is probably what you're  
hearing if you're syncing over a LAN), you can periodically do a round- 
trip adjustment.  You send a UDP ping out, wait for a return and  
measure the round-trip latency.  Divide that by two and you've got a  
good pre-delay for the master.  Then you make sure to delay the master  
by the pre-delay you've found.  Super simple and effective.

so you go like this:
1) determine the latency via 1/2 round trip (call that latency L  
2) start looping, 24 times a quarter note L milliseconds before the  
next pulse do the following: send out a sync message that says it is  
the next 24th of a quarter note now, use a monotonically increasing  
sequence number.
3) on the slaves, when you get a sync from the network make sure it's  
higher than your current sequence number, then hard sync to the  
sequence number right now.
4) everybody determines what the time is by taking the number of  
samples from the last sequence number plus the number of samples per  
sequence number times the current sequence number.  If you miss a  
sequence number, this should still work out.

This exercise sounds really interesting, so I might just try it and  
post some code.


On Jan 29, 2009, at 8:56 AM, james.hurlbut at utoronto.ca wrote:

> Hi Guys, thanks for all the input to my question. As you can see in  
> my original post, my issue was with the sample OSC sync code I  
> downloaded from the Plork site which was generating 16th note sync  
> messages that were way off to any pair of ears. So yes, my question  
> was concerning creating decent musical sync messages over OSC.
> Sure, my players can gaze each other deep into the eyes or setup  
> some sort of janky nudging system but for my purposes I need things  
> to be musically synced bpm wise as the players will have little or  
> no musical talent, and well, lined up beats just sound good to my  
> MTV ears.
> Sorry if I set off all y'alls ubernerdiness with the incorrect  
> "sample accurate" description. Kassen, you being an electro rock  
> star, maybe you have some insights or code to share to get an  
> aspiring chuck dj superstar on the way to synced techno bliss? I  
> would much prefer to be spending my limited chuck time making music  
> than figuring out the idiosyncracies of UDP. Thanks all!
> james
> _______________________________________________
> chuck-users mailing list
> chuck-users at lists.cs.princeton.edu
> https://lists.cs.princeton.edu/mailman/listinfo/chuck-users

pauley at unsaturated.net

More information about the chuck-users mailing list