[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[sc-users] synthdef variant generation
this works fine:
(
var variants, synthdef;
variants = #[[0.2, 5, 0, 0], [0.2, 0.2, 0.1, 0]];
synthdef = SynthDef("foo", { |args=#[0.2, 5, 0, 0]|
Out.ar(0, PitchShift.ar(SinOsc.ar(200), *args));
}).variants = ();
variants.do { |args, i| synthdef.variants[i] = [\args, args] };
synthdef.send(s);
)
Synth("foo.0");
Synth("foo.1");
but (for reasons that are not made apparent by the example i'm
using...) i'd like to generate variants using a Control in the synthdef
rather than an explicit argument:
(
var variants, synthdef;
variants = #[[0.2, 5, 0, 0], [0.2, 0.2, 0.1, 0]];
synthdef = SynthDef("foo", {
var args;
args = Control.names([\args]).ir(variants[0]);
Out.ar(0, PitchShift.ar(SinOsc.ar(200), *args));
}).variants = ();
variants.do { |args, i| synthdef.variants[i] = [\args, args] };
synthdef.send(s);
)
but that breaks with this message: variant: "'foo.1' control: 'args'
size mismatch." any ideas on how to make it work?