Random Rhythms to Fill Specific Lengths

Is there a way to have a pattern take a specific amount of time (say a measure for example) and divide it using specific subdivisions so that the pattern takes up the entire time or would you have to specify the rhythms yourself?
So instead of having to say

\dur, Prand([
     [4],
     [2,2],
     [2, Rest(2)],
etc.....

have something that would choose a set of durations, maybe note durations or rest durations from sixteenth to a whole value but such that they equal the target length.

You have to generate all of the timings at once to ensure they add up to the right amount, but this is no big deal. Try:

Pbind(
	\loopDur, 4,
	\dur, Plazy({
		|event|
		event.use {
			~loopDur * Pseq(
				16.collect({ rrand(1/8, 1/4) }).normalizeSum
			)
		}
	}).repeat
).play
6 Likes

what would be a good way to save the last variation you heard? i’ve been wondering this for some time… :~]

Awesome! So you just drop the values you want into the collect function?

If you don’t mind the last value maybe being shorter than the others, there’s Pconst (for a stream of numeric durations) or Pfindur (for a stream of events). See the Practical Guide to Patterns “Repetition and Constraint” chapter in the main help.

hjh

1 Like