I am struggling to find the right syntax for multichannel expansion in a pattern. Let say I have this:
Pdef(\test, Pbind(\midinote, [60, 65])).play
which mulitichannel expands like expected.
Now instead of fixed pitches I want to randomize the midinotes for both channels. I tried
Pdef(\test, Pbind(\midinote, [Pwhite(60, 70), Pwhite(60, 70)])).play
and some other solutions, none of them seem to work. How do you multichannel expand value patterns?
Hi,
you need a Ptuple (or another Pattern), which produces a sequence of Arrays. An Array of Patterns doesn’t do that.
Pdef(\test,
Pbind(
\midinote, Ptuple([Pwhite(60, 70), Pwhite(60, 70)], inf)
)
).trace.play;
Pdef(\test,
Pbind(
\midinote, Pfunc { { rrand(60, 70) } ! 2 }
)
).trace.play;
To be a bit hairsplitting, actually the Event handling of Arrays is more a multi-node expansion than multichannel expansion. As the default instrument has a pan
parameter you could add this feature as well:
Pdef(\test,
Pbind(
\midinote, Ptuple([Pwhite(60, 70), Pwhite(60, 70)], inf),
\pan, [-1, 1]
)
).trace.play
Thanks @dkmayer, just what I needed.