the answer is already here, dup dont have index of iteration passed as argument, i just dumbly fill Array with same function evaluation, thats the reason on the first place. I tried to initiate synth that is based on freq 440 * nothing, The confusing part is they existed on sever but hasnt freq defined in SInOsc. Like they dont have func envirement where they have different buffer, but it looked like it did. Every iterative method was could be used . Array.fill, .collect (Func that act like Array.map in other langs).
SynthDef("a", {
arg ratio=1, base, amp, out;
var sig;
base = base*ratio;
amp = (ratio.log2 * \tilt.kr(-24)).dbamp * amp; // multiply by amp
sig = amp*(SinOsc.ar(base));
Out.ar(out, sig ! 2)
}).add
(
var func;
func = {
|harmonics, even_uneven_ratio, freq, tilt|
var a = Array.fill(harmonics,{
| harmonic |
var b;
if (harmonic.odd{} { even_uneven_ratio = 1});
b = Synth("a", [
base: freq,
ratio: harmonic + 1, //ratio of 0 gives infinite volume!
amp: even_uneven_ratio,
])});
};
func.value(harmonics:64,even_uneven_ratio: 0.5,freq: 442,tilt: -3)
)
This works completely fine as well just calling Synth every time with new ratio
this is valuable statement that log2(0) is infinite, so you can just not do Synth if it if ratio = 0. Ofc you dont need a synth running at 0 freq
I actually would wish a friendly practical tutorial, step by step, im not a programmer at all, why i learn that iterations start from zero only now? like isnt it the base of programming languages, it would be handy i knew this binops, operators without trying to skip 80% of boring video on yt, or wathing it directly in documentation. You dont start with documentation right?
In supercollider it makes sense, its not C