hi guys,
I’m working on a new topic today, making some experiments with the pattern set
type and, as usual , I came across something I cannot understand.
Follow my steps:
// FIRST EXAMPLE ////////////////////////////////////////////////////
// Let's start booting the server and creating a simple synth definition
s.boot;
(
SynthDef(\test, {
|out=0, pan=0.0,freq=440, amp=0.4|
var sig = SinOsc.ar(freq) * amp;
Out.ar(out, Pan2.ar(sig, pan));
}).add;
)
// and instantiate the synth
x = Synth(\test)
// as we know we can set parameters of the synth manually
x.set(\freq, 440.rrand(880) )
// I recently found out that I can do this also with a pattern,
// if I use the \set \type.
(
Pbindef(\test_ctrl,
\type, \set,
\instrument, \test, // is this mandatory??
\id, x,
\amp, 0.6,
\freq, Pwhite(440, 880, inf).trace
).quant_([4]).play;
)
// when we are happy, we can get rid of everything
(
Pbindef(\test_ctrl).stop.clear;
x.free;
)
// SECOND EXAMPLE ///////////////////////////////////////////////////
// Now let's try the same thingh with some modifications: now
// I'm interested in making the pattern trigger a new percussive
// envelope so, let's create a new synthdef.
(
SynthDef(\test_perc, {
|t_gate=0, out=0, pan=0.0,freq=440, amp=0.4|
var env = EnvGen.ar(Env.perc(0.0, 0.1), t_gate);
var sig = SinOsc.ar(freq) * amp * env;
Out.ar(out, Pan2.ar(sig, pan));
}).add;
)
// let's instantiate the synth
x = Synth(\test_perc)
// and set the gate parameter to create a new envelope
x.set(\t_gate, 1)
// now, let's try the same thing as before: make the pattern do the job
// You will find that this won't work at all
(
Pbindef(\test_perc_ctrl,
\type, \set,
\instrument, \test_perc,
\id, x,
\amp, 0.6,
\t_gate, Pseq([1],inf).trace
).quant_([4]).play;
)
// when we are happy, we can get rid of everything
(
Pbindef(\test_perc_ctrl).stop.clear;
x.free;
)
Why the second example is not working the “same” way as the first?
What’s the difference between sending the t_gate
parameter setting via the .set method and via pattern?
Thank you as always for your help
PS: maybe related to this?