SynthMaker

help with simple delay

Archive · 2006 6 old posts

From the original SynthMaker forum (2004–2014), with its members’ names and dates.

subrock ·

Hello, I am tryig to code a simple delay using a buffer. There is something wrong(no sound) and I'd appreciate it if someone could figure out what I'm doing wrong.

streamin in; streamout out; float i; float j; float dlybuffer[44100]; float delaytime =.5;

i=(i>=44100)&0;

dlybuffer[rndint(i)]=in;

j =rndint(i- (delaytime*44100));

i=i+1;

j= (j<0)& (44100+j); out=dlybuffer[rndint(j)];

oddson ·

Not sure what's wrong. Here's the code I use for a delay.

streamin in; streamout out; monoin offset; //delay in samples float array[88200]; float index; // index of input write float outdex; // index of output read offset = rndint(offset);

index=index+1; //increment index index=index-(index>=88200)&88200; //deal with overflow of write index array[index] = in; // write to array outdex = index - offset; // calc read point outdex=outdex + (outdex < 0)&88200; // deal with overflow of read index out=array[outdex]; // read array to output

It looks roughly equivalent to yours. Could be the round integers don't work inside variable assignments for arrays.

Shifrin ·

subrock wrote: dlybuffer[rndint(i)]=in;

It's been a while since I've played with SM, but I am pretty sure it doesn't like expressions/function calls used as an array index - unless things have changed - I had lots of problems with this and in the end had to use a temporary variable like :-

tmp = a*x +b*y etc... somevar = array[tmp];

Shif.

ROMplERbuDE ·

Hy all, here is an example. I added a 3rd var, (t) for (timeconversion). 😀 Hope that this is what you mean?

streamin in; streamout out; float i; float j; float t; float dlybuffer[44100]; float delaytime =0.9;

dlybuffer[i]=in;

t = delaytime * 44100 - 0.5; t = rndint(t);

j = i - t ; j = j+(j < 0) &+ 44100; // Edit j = dlybuffer[j];

i = i + 1; i = i - (i >= 44100) &44100;

out = j;

angstrom ·

this is pretty much what I use

streamin in; streamout out; monoin delay;

float read; float index; float mem[88200];

//write index=index+1; index=index-(index>=88200)&88200; mem[index]=in;

// read read = index - delay; read = read + (read < 0)&88200; read = mem[read];

out=read;

the 'delay' input will expect samples so do an external conversion if you want a knob that reads in seconds

subrock ·

thanks for the help , I will try these code out

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.