SynthMaker

Array calculation Vs. single Parameter

Archive · 2012 4 old posts

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].

Before your first post

A few rules keep this a friendly place. You agree to them once.

Shown next to what you post, here and in the app. It doesn’t have to be your real name: 3–24 lower-case letters, digits or _ (capitals become lower case, spaces become _).

    Then your post goes up straight away.

    Delete this reply?

    Open it in SynthMaker?

    It goes on the track you’re editing there, in place of that track’s sound, and into My sounds. Your other tracks stay as they are.

    Want to keep that track’s sound? Start a new song in SynthMaker first (Song › New song), then open this.

    Report this reply?

    Only the developer reads reports. The person isn’t told who reported them.

    What’s wrong with it?

    Block this person?

    You won’t see their posts and replies here any more. They aren’t told, and you can unblock them at any time.

    People you’ve blocked

    Their posts and replies are hidden from you. Unblock someone to see them again.

    The community rules

    A few rules keep this a friendly place. Everyone agrees to them once, before their first post.