I am trying to learn from this example Control | SuperCollider 3.12.0 Help and can’t seem to understand how does this exactly work
(
SynthDef(\test, { arg out=0, i_freq;
var klank, n, harm, amp, ring;
harm = \iharm.ir(Array.series(4, 1, 1));
amp = \amp.ir(Array.fill(4, 0.05));
ring = \ring.ir(Array.fill(4, 1));
klank = Klank.ar(`[harm, amp, ring], {ClipNoise.ar(0.003)}.dup, i_freq);
Out.ar(out, klank);
}).add;
)
Then you can pass \harm as a parameter like this
Synth(\test, [\i_freq, 500, \iharm, [4, 1, 4, 6]]);
and it works
However, when i try to make the harm unparametrized, and set its values dynamically by some other logic inside the synthdef
(
SynthDef(\test, { arg out=0, i_freq;
var klank, n, harm, amp, ring;
var iharm = [4, 1, 4, round(MouseX.kr(1,6))];
harm = \iharm.ir(Array.series(4, 1, 1));
amp = \amp.ir(Array.fill(4, 0.05));
ring = \ring.ir(Array.fill(4, 1));
klank = Klank.ar(`[harm, amp, ring], {ClipNoise.ar(0.003)}.dup, i_freq);
Out.ar(out, klank);
}).add;
)
I get an error Message 'ir' not understood.
Why is that? And how can i control these variables inside synthdef rather than have them as an argument?