-
I've been playing with Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Thanks for the question! Looking at it now, I'm realizing I should probably improve To sub-divide a "step" of pcycles, you'll want to be sure you're using a list rather than a string. So for example: Flat list of 6 elements. Yields 6 events, each 1/6 dur as expected: > (next-upto-n (pcycles '(1 - - 2 - -) :repeats 1))
((EVENT :VALUE 1 :DUR 1/6)
(EVENT :TYPE :REST :DUR 1/6)
(EVENT :TYPE :REST :DUR 1/6)
(EVENT :VALUE 2 :DUR 1/6)
(EVENT :TYPE :REST :DUR 1/6)
(EVENT :TYPE :REST :DUR 1/6)) List of 4 elements, whose last element is a 3-element sub-list. Also yields 6 events, but the first 3 fit in 3/4 dur, while the last 3 fit in 1/4 dur: > (next-upto-n (pcycles '(1 - - (2 - -)) :repeats 1))
((EVENT :VALUE 1 :DUR 1/4)
(EVENT :TYPE :REST :DUR 1/4)
(EVENT :TYPE :REST :DUR 1/4)
(EVENT :VALUE 2 :DUR 1/12)
(EVENT :TYPE :REST :DUR 1/12)
(EVENT :TYPE :REST :DUR 1/12)) Besides dividing the For now,
> (next-upto-n (pcycles '(foo 1 (2 3)) :repeats 1 :map (list 'foo (event :value 9))))
((EVENT :VALUE 9 :DUR 1/3) ; 'foo has been replaced with (event :value 9)
(EVENT :VALUE 1 :DUR 1/3)
(EVENT :VALUE 2 :DUR 1/6)
(EVENT :VALUE 3 :DUR 1/6))
> (next-upto-n (pbind :amp 1/4
:embed (pcycles '(62 - (64 65)) :repeats 1 :key :midinote)))
((EVENT :AMP 1/4 :MIDINOTE 62 :DUR 1/3) ; :amp is set to 1/4 as per the pbind, but the pcycles yields :midinote values rather than :value
(EVENT :AMP 1/4 :TYPE :REST :DUR 1/3)
(EVENT :AMP 1/4 :MIDINOTE 64 :DUR 1/6)
(EVENT :AMP 1/4 :MIDINOTE 65 :DUR 1/6))
> (next-upto-n (pcycles '(62 - 64 65) :repeats 1 :dur 4))
((EVENT :VALUE 62 :DUR 1) ; :dur is 1 rather than 1/4, thus one "cycle" is 4 beats long rather than the default of 1 beat long
(EVENT :TYPE :REST :DUR 1)
(EVENT :VALUE 64 :DUR 1)
(EVENT :VALUE 65 :DUR 1))
> (next-upto-n (pcycles '(62 -) :repeats 2)) ; 2 items in the input list * 2 repeats of the input list = 4 total events before pcycles ends.
((EVENT :VALUE 62 :DUR 1/2)
(EVENT :TYPE :REST :DUR 1/2)
(EVENT :VALUE 62 :DUR 1/2)
(EVENT :TYPE :REST :DUR 1/2)) |
Beta Was this translation helpful? Give feedback.
-
This is fantastic, thank you! |
Beta Was this translation helpful? Give feedback.
Thanks for the question! Looking at it now, I'm realizing I should probably improve
pcycles
' docstring to make its functionality more clear; the current one is pretty sparse.To sub-divide a "step" of pcycles, you'll want to be sure you're using a list rather than a string. So for example:
Flat list of 6 elements. Yields 6 events, each 1/6 dur as expected:
List of 4 elements, whose last element is a 3-element sub-list. Also yields 6 events, but the first 3 fit in 3/…