Multichannel expansion in patterns sending [Env.perc].asArray

Hi everyone,
how could I send the env-array to do a multichannel expansion correctly?

SynthDef(\DcOuts){|durSeconds=1, amp=1, bus=0|
    var env = \env.kr(Env.newClear(8).asArray);
    var sig = EnvGen.kr(env, timeScale:durSeconds.poll, doneAction:2) * amp;
    Out.kr(bus, sig);
}.add;

(
Pbindef(\ph5,
    \instrument, \DcOuts,
    \bus,Pseq((0..5),inf),
    \env, Pseq([ [Env.perc]],inf),
    \dur, Pseq([1/4],inf),
).play;
)

(
Pbindef(\ph5, \env,Pseq([ [[ [Env.perc], [Env.perc(0.999,0.001,1,4)] ]] ], inf)).play;
)

Really thanks in advance

You need the “template” of the envelope you want to pass in the SynthDef.
Here your example with audio out

SynthDef(\DcOuts, {|durSeconds=1, amp=1, bus=0|
	var env = \env.kr(Env.perc.asArray);
	var sig = EnvGen.kr(env, doneAction:2).poll * amp * SinOsc.ar(400);
    Out.ar(bus, sig);
}).add;

(
Pbindef(\ph5,
    \instrument, \DcOuts,
	\env, Pseq([ [Env.perc(0.02, 1)], [Env.perc(0.5, 0.02)] ],inf),
    \dur, Pseq([0.5],inf),
).trace.play;
)

It’s also possible to pass envelopes of different lengths via patterns, then you need a maximum template. miSCellaneous_lib quark’s tutorial “Event patterns and array args” contains examples for this.

1 Like