-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
Make cps patternable #1001
Make cps patternable #1001
Conversation
I don't think this is a hack.. this partly fixes #51 You could also use this like
When #1004 is merged, this one probably needs to be updated to use this.setCps.. |
Yes tidal has this functionality too. Based on my experience with tidal, there could be problems when the cps changes part way through a frame. This can result in events getting doubled up or missed. |
Ok to merge this for now and improve with later PR(s)? |
I posted a summary of the situation here: #51 (comment) |
@@ -52,6 +52,10 @@ export class Cyclist { | |||
// see https://github.com/tidalcycles/strudel/pull/1004 | |||
const deadline = targetTime - phase; | |||
onTrigger?.(hap, deadline, duration, this.cps, targetTime); | |||
if (hap.value.cps !== undefined && this.cps != hap.value.cps) { | |||
this.cps = hap.value.cps; | |||
this.num_ticks_since_cps_change = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose this shouldn't be 0 as we're partway through a tick. Perhaps somewhere between -1 and 0 ??
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's an integer counter... the tick is the smallest unit of handled time. In a tick you feed a fixed-size audio buffer. You could go down to the single sample but i think performance could be killed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure but to handle smooth cps changes then we would need sub-tick precision. I think this is an issue for solving in a later PR though.
Ok merged, thanks! |
Little hack, you can change the global inner clock with the cps() control function. Very dangerous but very satisfying. You can bring the cps to 0 and stop the playback, also. Negative numbers work in theory (the pianoroll goes in reverse) but no correct audio is produced.
Practical example:
https://youtu.be/No1dQWJKQNU