Ableton / LinkKit

iOS SDK for Ableton Link, a new technology that synchronizes musical beat, tempo, and phase across multiple applications running on one or more devices.
http://ableton.github.io/linkkit
Other
147 stars 10 forks source link

Polyrhythm #51

Closed mgeilich closed 2 years ago

mgeilich commented 5 years ago

I would like to synchronize two different devices playing at different tempos. Both devices should play beat 1 of every measure at the same time, but device #1 will beat 3 beats per measure while device #2 will beat 4 beats per measure for example - so only beat 1 of each measure will occur at the same time on both devices.

I have tried to build this using a common tempo. For example, set a bpm of 30 and have each device play at a tempo of bpm*quantum. But I haven't been able to get it to work.

Any idea how this can be accomplished using the sample project as a base?

0Dmitry commented 5 years ago

One possible solution I could think of is set quantum to 1 for both devices, so the downbeats are synchronised. And then just calculate subdivisions of a beat. One instance can play 4 sub-beats per beat while the other 3 sub-beats.

mgeilich commented 5 years ago

Yes, I think to do this, I need to make quantum a subdivision of a beat instead of a multiple of a beat. I'm having trouble figuring out how to do that.

olympianoiseco commented 5 years ago

The quantum time doesn’t really matter here.

If you want 3:4 polyrhythms you have one part trigger on beats 0.0 1.0 2.0 3.0

and the other on beats 0.0 1.333333 2.66667

fgo-ableton commented 5 years ago

To nit pick. I think the quantum matters to some extend. You want to set it to what the measure is. Setting it to one beat might work for two peers. But it will not share the downbeat with the other peers in the session.

mgeilich commented 5 years ago

Seems like a one beat quantum would not allow fine-grained tempo changes. Could I use a fixed quantum of 4 for all peers and then to have one peer beat 3 against 4, call beatAtTime() with quantum*4/3 and use the resulting hostTime for phaseAtTime()?