Hey there
I’m running SC 3.9.3.
I’m having difficulties understanding t_ arguments to Synthdef.
In the Synthdef help file there’s the following code snippet :
// the following two defs are equivalent. The first uses a 't_' arg:
(
SynthDef(\trigTest, { |out, t_trig=0, freq=440| // t_trig creates a TrigControl
Out.ar(out, SinOsc.ar(freq+[0,1], 0, Decay2.kr(t_trig, 0.005, 1.0)));
}, [0, 4] // lag the freq by 4 seconds (the second arg), but not t_trig (won't work anyway)
).add;
)
// This second version makes trig a \tr arg by specifying it in the rates array.
(
SynthDef(\trigTest2, { |out, trig=0, freq=440|
Out.ar(out, SinOsc.ar(freq+[0,1], 0, Decay2.kr(trig, 0.005, 1.0)));
}, [\tr, 4] // lag the freq (lagtime: 4s), \tr creates a TrigControl for trig
).add;
)
// Using the second version create a synth
z = Synth.head(s, \trigTest2);
// now trigger the decay envelope
z.set(\trig, 1); // you can do this multiple times
z.set(\trig, 1, \freq, 220); // hear how the freq lags
z.set(\trig, 1, \freq, 880);
z.free; //free the synth
but
z = Synth(\trigTest);
z.set(\trig, 1);
does not trigger any sound.
Could someone explain why I should name a Synthdef parameter t_trig instead of trig and the magic involved ?
Thanks in advance !
geoffroy