rocko ·
Hi,
I can not find why these two codes provide a differnet output (from the same input):
Any suggestion what am I missing here?
Thanks, Rocko
From the original SynthMaker forum (2004–2014), with its members’ names and dates.
rocko ·
Hi,
I can not find why these two codes provide a differnet output (from the same input):
Any suggestion what am I missing here?
Thanks, Rocko
martinvicanek ·
I believe that SM can't deal with 2 array elements in one assignment like D[2] = D[1]. You can connect a textbox to the OSM output (edit: ASM output) to confirm.
rocko ·
Hi,
You are right.
So I replaced the D[3]=D[2] expressions into:
tmp = D[2]; D[3] = tmp;
And it works well, thanks !
Next step I tried to put it into a loop:
n=3; loop(3) { tmp = D[n-1]; D[n] = tmp; n=n-1; } D[0] = input;
And it failed. Do you have a clue why?
Rocko
martinvicanek ·
SM does not evaluate the expression tmp = D[n-1]; correctly. A workaround would be n = n - 1; tmp = D[n]; n = n +1; but that's really awkward.
My advice: use arrays in SM only when absolutely necessary (e.g. in a delay by 44100 samples). Note that SM's arrays are inefficient CPU wise. Avoid arrays whenever possible: expand your loops, use code like in2 = in1; instead. The drawback is that you have to decide about the array length in advance, but then again, you can't use dynamic loops loop(n) in SM code anyway (although some gurus figured out how to do that in ASM).
Wrote something here? To have a post removed or your name hidden, write to [email protected].