[delay]s aren't supposed to continuously loop are they?

to_the_sun's icon

I'm just getting into gen and this is my first use of a delay. I have it working correctly; what I write to the delay can be read 8 seconds later as i want, EXCEPT then it continues to pull those exact readings out of the delay every 8 seconds after that! I'm extremely burnt out from trying to figure this out.

This should be the only relevant part of my codebox:
if(vibe >= 0) {
    time.write(hippocampus.peek(vibe)); //this should be the only time anything is put through the delay line
    vibe -= 1;                            //(unless i don't know how to use a delay?)
    check += 1;                            //i'm checking the number of times this occurs
    out3 = check;                        //and it's the right amount
}
forget = time.read((wake / 1000) * SAMPLERATE); //this is the only time the delay is read
if(forget) {                            //and yet this is occuring on a continuous loop
    //out2 = 99;                        //(every 8 seconds) instead of just once per 'vibe' to 'forget'
    for(j = forget - tolerance; j
        tempo.poke(tempo.peek(j) - 1, j);
    }
}

Here's the patch in its entirety if you wanna look at it:

Max Patch
Copy patch and select New From Clipboard in Max.

Help?

to_the_sun's icon

God damn it. Looks like copy compressed screwed something up and the gen doesn't compile now.. Well you can still LOOK at it.

to_the_sun's icon

Ok it compiles now:

Max Patch
Copy patch and select New From Clipboard in Max.
Max Patch
Copy patch and select New From Clipboard in Max.

Here's consciousness.gendsp:

to_the_sun's icon

SOLVED! It turns out you can't just write a value or two to the delay and then leave it alone every other sample (like if it's within an if statement for example), you must write to it EVERY sample, even if you're just writing 0 continually. Unless you want this interesting behavior to manifest, that is...

Graham Wakefield's icon

The delay's time step is always moving forward. If you don't write(), the existing data will be left as it was. If this isn't what is desired, then pull the write() outside of the if() statement, but write zero when vibe == 0.

Note also that if you write() several times to a delay within the same genpatcher, the last write() will override the others (or mix with them, if you have a non-zero overdub parameter).

Time must still advance by one sample regardless how many write() calls there are (and even if there are none).

to_the_sun's icon

Can't say I understand completely, but that's essentially what I did. I just added a else {
time.write(0);
}

after the if() .

So is a delay essentially a buffer with size equal to its declared first argument (the max delay), that shifts all of its data one index every sample? Or it shifts only every time you write() to it? Then when you read, you're essentially peek()ing at it?

I did forsee your second point and from the start i had created a queue (Data hippocampus()) that could slide numbers into the delay sample by sample, when many of them are generated in a single sample.

I just started with this gen stuff and i must say I'm liking it and want to understand as much as possible.

Graham Wakefield's icon

Yes it is a memory buffer whose size is determined by the first argument. It doesn't shuffle data, instead the write location is incremented by 1 sample frame for each sample frame of the gen. (This happens regardless whether you write or not ) The delay time in read() is subtracted fro. this location, which effectively means reading from the past.

to_the_sun's icon

And the first and last frame are treated as though they're contiguous. It all totally makes sense now, thank you.