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

Functions for scheduling multiple upcoming changes to a voice in one shot. #1049

Open
wants to merge 12 commits into
base: dev
Choose a base branch
from

Conversation

JeffreyBenjaminBrown
Copy link
Contributor

Adds two user-facing functions (and a number of coder-facing helper functions):

(1) sched is like jumpIn. Whereas jumpIn schedule one cycle to take over at some point in the future, sched schedules multiple things (and accepts fractional times).

Here's an example:

do setcps 1
   d1 $ s "[bd,numbers]" |* n (slow 8 $ run 8)
   sched 2 [ (2, s "lt*5"),
             (4, s "ht*4"),
             (6, s "hc*3") ]

In the above, voice d1 will audibly count numbers as soon as it's evaluated. d2 will wait two cycles, then start playing "lt5" for two cycles, then "ht4" for two cycles, and then "hc*3" from then on.

(2) schod stands for schedule modulo. It is like jumpMod, except it lets you specify multiple changes (and accepts fractional times). The user specifies a divisor (probably a multile of 4 if you use straight time), and times scheduled are relative to the start of the most recent cycle that was divisible by the divisor.

Here's an example:

do setcps 1
   d1 $ s "[bd,numbers]" |* n (slow 8 $ run 8)
   schod 2 8 [ (2, s "lt*5"),
               (4, s "ht*4"),
               (6, s "hc*3"),
               (8, s "~ sn:1" ),
               (12, s "~ ~ sn:1" ),
               (16, silence) ]

Here the voice being scheduled is d2 and the divisor is 8. Suppose the current cycle is 11. In that case, since 11 is equal to 3 mod 8, and 2 < 3, voice 2 will immediately start playing "lt5". At cycle 12 (since 12 = 4 mod 8), it will switch to "ht4". At cycle 14 it plays "hc*3". At cycle 16 it plays "~ sn:1". At cycle 20 it plays "~ ~ sn:1". Etc.

Notice that the times being scheduled can be greater than the divisor. The divisor is only used to specify the start time.

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

Successfully merging this pull request may close these issues.

None yet

1 participant