I am pretty sure that this begginer’s question have been asked in the list, but I couldn’t find it there.
How can I make multiple and independent pitchEvent keys inside a SynthDef ? I would like to have multiple freq arguments that would support freq/midinote/note/degree and would be independently controllable from patterns. Is it described on the doc? Something like this:
Check out array arguments (SynthDef help file). Whenever you write something like xy1, xy2 etc. consider writing arrays.
For some reason especially array args seem to fbe unpopular, or they are poorly documented, or both. Array args are a bit tricky with patterns though - but not really, just note that you have to wrap into an extra array to avoid expanding into multiple synths per event (which normally happens if you use arrays within event patterns).
arg freq = #[440, 2, 0.1], out;
sig = PMOsc.ar(freq, freq, freq);
Out.ar(out, sig * EnvGen.ar(Env.perc, doneAction: 2))
f = Pbind(
Pseq([0, 1, 2, 4, 6, 3, 4, 8], inf),
Pwhite(-7, 7) ,
Pbrown(0, 7, 1)
]).collect([_]), // wrap into extra array
\octave, [[5, 3, 2]] // wrap into extra array here too
The miSCellaneous_lib quark contains a tutorial “Event patterns and array args”.
Also see Nathan’s note on NamedControl, esp. the chapter “Advantage: Better multichannel controls”:
My answer was a quite formal one, another point is if it makes sense to pass the index as degree. Also if you are fine with inharmonic spectra, you could e.g. think about passing the modulation frequency by an integer factor or a simple fraction of the carrier etc.