Try something like:
(
Pdef(\a, Pbind(
\dur, 1/8,
\octave, 4,
\scale, Scale.hexSus,
\degree, Pseq([-1, 1, 4], inf)
));
Pdef(\b, Pbind(
\dur, 1/8,
\octave, 4,
\scale, Scale.hexSus,
\degree, Pseq([-2, 2, 4], inf)
));
Pdef(\sequence, Pseq([
(
Pbind(
\octave, 3
) <> Pdef(\a)
).finDur(4),
(
Pbind(
\octave, 3
) <> Pdef(\b)
).finDur(4),
(
Pbind(
\octave, 4
) <> Pdef(\a)
).finDur(4),
(
Pbind(
\octave, 4
) <> Pdef(\b)
).finDur(4),
], inf)).play;
)
- Just sequence your Pbinds in a Pseq - this is what it’s for.
-
finDur
limits the duration of a long-running pattern. If instead you want a pattern with a finite duration that you repeat a certain number of times, make sure your element patterns don’t run forever, and then use .repeat(4)
instead (to repeat e.g. 4 times).
- You can override properties of your “generic” high-level Pbinds
\a
and \b
by composing with another Pbind using <>
. Keep in mind that the left-hand-side pattern overwrites the right-hand-side pattern - so things on the left will overwrite keys, while things on the right will basically “inject” keys that can be used by patterns on the left-hand-side. You could also do something like this, to supply \a with “parameters”:
Pdef(\a, Pbind(
\octave, 3 + Pkey(\octaveOffset)
));
Pdef(\a) <> Pbind(\octaveOffset, 0);
- If you want one set of overarching controls for every pattern, you can compose in a “control” pattern and then set values in it. In this case, re-defining you Pdef will immediately swap it into playing patterns, allowing you to change parameters on the fly.
Pdef(\controls, Pbind(
\octave, 3
));
Pdef(\controls) <> Pdef(\a)
- Pdefs have their own keys that can be set no matter what’s inside of them. This means there’s a convenient way to have a sort of key-value setability for this kind of
\controls
pattern:
// no need for keys in the Pbind, since you set them in the .set
Pdef(\controls, Pbind()).set(\octave, 4, \amp, 0.5);
// ... now you can do this to change the octave during playback:
Pdef(\controls).set(\octave, 5)
- If you want manual control during playback of e.g. which pattern is playing, define your patterns the same way and then play them via a “player” pattern. You can switch to different patterns by simply changing whats inside the player pattern - you can use things like the
quant
setting to control when the switch happens (e.g. quantized to one bar, etc).
Pdef(\player, Pdef(\a)).play;
// to switch to the next pattern while playing....
Pdef(\player, Pdef(\b));