Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic alignment of cycles in Link sessions #936

Open
Zalastax opened this issue Aug 7, 2022 · 5 comments
Open

Automatic alignment of cycles in Link sessions #936

Zalastax opened this issue Aug 7, 2022 · 5 comments

Comments

@Zalastax
Copy link
Collaborator

Zalastax commented Aug 7, 2022

Before #898, Tidal instances would share tempo over the network. This included cycles per second, but also the current cycle. After #898, cycles per second is shared, but the current cycle is not. This happens because Ableton Link does not align beat/cycle values between session participants. Quoting Link documentation "For example, beat 1 on one participant’s timeline might correspond to beat 3 or beat 4 on another’s, but it cannot correspond to beat 3.5".

A workaround exists: it is possible to align cycles manually by using resetcycles in each Tidal instance simultaneously.

It would be neat if cycles could again be automatically aligned across Tidal instances. Two ideas for achieving it:

  1. Have Tidal instances gossip what cycle they are at. Instances that receive this information should use the Link API requestBeatAtTime to move their beat accordingly.
  2. Create an alternative to resetcycles that resets the cycles of all Tidal instances in the local network.
@yaxu
Copy link
Member

yaxu commented Aug 9, 2022

Is this what the link concept of the 'quantum' is for? Perhaps we could just assume a quantum of 4, but have this configurable - would that solve it?

@Zalastax
Copy link
Collaborator Author

Zalastax commented Aug 9, 2022

It would not solve it. If two Tidal instances have a quantum of 4, Link will ensure that instance_1_beat % 4 = instance_2_beat % 4. This issue is about the use case of ensuring that instance_1_beat = instance_2_beat so that instance_1_cycle = instance_2_cycle. My understanding of Link is that it does not provide a means to achieve that.

As an example, let's assume instance 1 has been running for a while and that instance_1_beat = 4005 with quantum = 4 and beats per cycle = 2. This corresponds to instance_1_cycle = 2002.5. When instance 2 joins (also with quantum = 4 and beats per cycle = 2), Link will set instance_2_beat = 1, ensuring that instance_1_beat % 4 = instance_2_beat % 4 = 1 and instance_2_cycle = 0.5. This is simplified (requestBeatAtTime works slightly differently), but should hopefully give you the gist of the idea.

@yaxu
Copy link
Member

yaxu commented Sep 14, 2022

Hey @Zalastax I still think there is something about quantum we're missing here.

Ableton Link does not align beat/cycle values between session participants. Quoting Link documentation "For example, beat 1 on one participant’s timeline might correspond to beat 3 or beat 4 on another’s, but it cannot correspond to beat 3.5". If aligned cycles is desired, use resetcycles in each Tidal instance simultaneously.

I think this is a misunderstanding. If you continue from that quote the next section is on phase alignment, which is for aligning cycles with quantum.

There's a problem here that tidal doesn't deal with beats, but cycles (measures).. So where beat-driven software has bpm of 60 and quantum of 4, to match the cycles we want cps of 0.25 (i.e. cpm of 15). There is no quantum in tidal there is no concept of a fixed beat.

To convert to beatworld, we do need the quantum though. This is down to human judgement, because it depends on the time signature, and neither the link protocol or tidal care about that. Probably we want to set the quantum to be the same as whatever is in the other system, in the above case 4. Then we can convert to link's bpm by multiplying cps by the quantum * 60.

Probably a default of 4 is best, but it would be nice to have this configurable and ideally patternable..

@yaxu
Copy link
Member

yaxu commented Sep 14, 2022

Or maybe I'm just not understanding the problem you see here.. You're thinking about aligning tracks that have a beginning and end, where it's important that the cycle values are the same? As opposed to having repetitive cycles where you just have to get them in phase, and don't care about the exact cycle numbers being the same.

@Zalastax
Copy link
Collaborator Author

Your last comment captures it fully @yaxu! Before Link introduction, two synchronized sessions could expect the same result when evaluating a function like https://tidalcycles.org/docs/reference/conditions/#when. I don't have this use case but I wanted to mention it as a newly introduced limitation so we can take a proper decision on if it needs to be addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants