It works
{SinOsc.ar(120*[1,2,3,4,5,6,7,8,9])!2 * 0.1}.play;
But It seems doesn’t work.
(
Ndef(\test2, {
arg freq = 440;
var sig = SinOsc.ar(freq, mul: 0.43);
Out.ar(0,sig!2);
};
)
)
~a = [1,2,3,4,5,6,7,8,9];
Ndef(\test2).play;
Ndef(\test2).xmap(\freq, 220);
Ndef(\test2).map(\freq, 220*~a);
But It seems not to be working,
Is there any way to use a multiple frequencies as a input of Ndef or SynthDef?
This Ndef is running a synth.
A synth must be based on a SynthDef.
A SynthDef must be a fixed structure. It can’t add or remove UGens on the fly.
This synthesis design specifies one frequency. So the only way to make it handle more frequencies is to edit the synthesis function to support an array of frequencies – to replace the synthesis structure in its entirety.
There is no argument you can pass in to make this expand dynamically, because that would be changing the synthesis structure based only on argument values, and this is never supported in any context, in SC.
You’ll have to design the synth to accept up to n frequencies, and then use other arguments or logic to suppress the output of the ones you’re not using at a given moment.
hjh