SynthMaker

How do I drop a buffer in code?

Archive · 2006 8 old posts

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

angstrom ·

Hi all, how do I drop a buffer in code

imagine I have something like this

float mem[44100];// heres a buffer mem[index] = in; index = index + 1; index = (index<delaylength)&index; out = mem[index];

I tried adding a green bool into a mono in called 'drop' and then a few variations on this kind of thing.

mem = (drop==1) & mem;

no joy though, in fact it really doesn't like that! so go on - let me in on the secret of deleteing a buffer and starting again. 🙂

sambean ·

Could be your bool input?

Try converting it to float first, or change the line to (drop>0)&mem

Cheers

Sam

angstrom ·

thanks sam, I tried an int and then a float conversion before I posted, I should have said it was actuallya float in of 0 or 1 rather than a true bool type.

anyway, adding anything with a mem reset in just stops the code.

Without the mem reset - There is a counter in the code that drives a position bar, attaching a mono to float an t25 fives me a green counter from the code module. I can see the numbers counting up usually. But, as soon as I try to add a reset on the mem[] ..

mem = ( anything) & mem;

the counter stops and all audio function from the code module fails.

I have tried other variations on the reset, but as the mem is an array it doesn't want to play by the rules of varibles, it seems.

stefan ·

Uhm... if mem is the actual array pointer you set the pointer to zero, and hence loose the actual reference to the memory you're using when you do mem = 0. That can't be what you want to do?

Is this in a mono section? If so, the best way to reset the memory is probably to disconnect this module from the section and then reconnect it. Atleast I think that should work.

angstrom ·

mem is the array name, index is the pointer. roughly:

float mem[352800]; float index; stage(1){ mem[index] = in; index = index + 1; mem = (drop>0) & mem; index = (index<delay)&index; out = mem[index]; }

I'm remaking my Angstrolooper, which was built in SE

Download VST installer which has a problem when you 'drop' or reset the buffer that there is a nasty CPU spike and an audio ka-thunk as the chain is re-processed. (drop is the icon with the circle and strike through )

I am guessing that If I disconnect and re-connect the code module I will get the same nasty effect, I'll give it a try though.

stefan ·

index is not a pointer. index is an index. mem is an pointer.

when you set the mem variable to zero, you lose the pointer to the memory you created for the array, and hence you have no access to the array any longer. You can't do mem = 0 when you want to reset the _content_ in the array to zero, because what you do is that you actually sets the pointer to the array to zero. And hence, renders it unusable.

angstrom ·

right, OK - a terminology mix-up there, but that's what I thought. I was thinking of array and float as types rather than pointers.

I had a quick go at the disconnecting solution: using a Select on the audio output .

Unfortunately that didnt empty the buffer, it just temporarily cut the audio out. The buffer was still full of audio.

stefan ·

angstrom wrote: right, OK - a terminology mix-up there, but that's what I thought. I was thinking of array and float as types rather than pointers.

I had a quick go at disconnecting - using a select on the audio output . Unfortunately that didnt empty the buffer.

Ok. I was expecting it to. And I think that it should work like that, but since it doesn't I don't have any decent work-around for you. Sorry.

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.