-
You cannot change the size of the control array after the synthdef is built (and sent to the server). If you need to have multiple array sizes, you have to generate different synthdefs for them. Those can share the same code general structure. There have been various frameworks done for this purpose, e.g. see SynthDef.wrap. But it’s not clear you actually need this here…
-
What dkmayer suggested was was not having
freqs
, andringtimes
as controls at all in yourdynKlank1
, i.e.
(
SynthDef(\dynKlank1, {|out, freq|
var freqs = #[800, 1071, 1153, 1723];
var ringtimes = #[1, 1, 1, 1];
//...
Is there a reason why those are settable as controls in dynKlank1
? (I.e. is there some code you haven’t show us that externally sets those in dynKlank1
?) Because having two control arrays of different sizes, with the same name, is going to be troublesome down the road. If you accidentally set the 3-element array to a 4-element one, the extra elements are silently discarded.
(SynthDef(\trouble, {
arg a = #[0, 0], x = 1, y = 2;
[a, x, y].poll(2);
}).add)
z = Synth(\trouble, [\a, #[1, 3, 5, 7]])
Outputs
UGen Array [0]: 1
UGen Array [0]: 3
UGen Array [1]: 1
UGen Array [2]: 2
- Code-style observation: mixing
arg
-style and Control.name style parameters is a fairly bad idea because it can become hard to keep track of what your synth args/controls actually are.