Hi All,
Very exited about my forst post here
I’m kind of new to supercollider so bare with me.
I want to do a simple iteration that layers various versions of a wave.
This code works fine:
(
SynthDef(\multipad, {
arg freq=100;
var temp, sum;
sum = 0;
10.do{
temp = VarSaw.ar(freq * {Rand(0.98, 1.02)}!2, {Rand(0.0, 1.0)}!2, 0.5, 0.08);
sum = sum + temp;
};
Out.ar(0, sum);
}).add;
)
x = Synth.new(\multipad);
x.free;
However when I change the Synth to accept a ‘layers’ argument for the amount of iterations, the program runs, but no iterations are made. This is the code:
(
SynthDef(\multipad, {
arg freq=100, layers=20;
var temp, sum;
sum = 0;
layers.do{
temp = VarSaw.ar(freq * {Rand(0.98, 1.02)}!2, {Rand(0.0, 1.0)}!2, 0.5, 0.08,);
sum = sum + temp;
};
Out.ar(0, sum);
}).add;
)
x = Synth.new(\multipad);
x.free;
Any help in the right directions would be very much appreciated
Have a nice Sunday,
Boris