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
luka
August 11, 2021, 10:56am
3
hi @dkmayer
Iām trying to convert this to āclassicā arg mode and it seems this does not work and I donāt understand why:
(
SynthDef(\DcOuts1, {
arg durSeconds=1, amp=1, bus=0, env = Env.perc.asArray;
//var env = \env.kr(Env.perc.asArray);
var sig = EnvGen.kr(env, doneAction:2) * amp * PinkNoise.ar;
Out.ar(bus, sig);
}).add;
)
(
Pbindef(\ph5,
\instrument, \DcOuts1,
\env, Prand([ [Env.perc(0.02, 0.5)], [Env.perc(0.2, 0.02)] ],inf),
\dur, Prand((1..10)*0.05,inf),
);
)
Pbindef(\ph5).play
Iām probably missing something about named controls. how can I avoid using them in your example above?
The default values in a SynthDef arg
block must be literal numbers or arrays ā 1 and 0 are literals, while Env.perc.asArray
is an expression.
The only way to create a synth input where the default is an expression is with NamedControl. It isnāt supported to convert this into a regular arg.
hjh
1 Like