I have created a synth which I use inside of a routine. Now, I need to instantiate multiple instances of my routine (I know it technically doesn’t make sense, I am trying to convey what I am looking for), all running simultaneously. What would be the supercollideric way of doing this, writing a new synth, which contains such a routine, and then instantiating that synth? I thought of something like the following code, but it is obviously not the correct way to do it.
(Note: the \line
synth is just another synth)
Any helps is highly appreciated!
(
SynthDef(\foo, {
Routine {
var count = 20, freqs = Array.geom(count, 10000, 0.75);
Array.geom(count, 1.1, 0.9).do {
arg x, i;
var dur = 1.exprand(x*10);
[x, i, dur, count, 1/count].postln;
Synth(\line, [\amp, 0.01.exprand(1/10), \dur, dur, \fr, freqs.at(i)]);
x.yield;
}
}
}).add;
)
(
2.do {
Synth(\foo);
}
)
r.reset
r.next