So, I'm back at it working on my experimental delay, and I've gotten to the point where it functions very much like intended, except for when I bypass the pedal (reroute the signal to have no processing) the feedback of the audio stored in sdram keeps playing when I turn the pedal back on (if I had the feedback up to make a sound-on-sound sort of effect or a delay loop or oscillation). Is there any way to make the button (aka bypass switch) clear whatever is stored in the sdram? Right now I'm just making the button also turn the feedback to zero, but if the delay time is long or the oscillations are very loud it takes a bit of time for it to clear, which is less than desireable. Any tips?
Emptying the sdram when X?
assuming you store the delay audio in a table, you could just make an object that wipes said table. couldn't find an existing one (really?? seems obvious), but worst case you can just write a quick loop that iterates through the length of the table and sets it to 0?
edit. i did this with my eyes closed, ie. no axoloti to compile but check the attached object.
if (inlet_trig){
for (int i=0; i<attr_table.LENGTH; i++){
attr_table.array[i]=0;
}}
clear.axo (543 Bytes)
Nice one weasel. You can also use rbrt's tcopy (or is it called tablecopy? Can't check right now.)
That lets you clear a table. Or a section of a table
I don't think I'm using a table. At least I'm pretty sure I'm not because I never figured out how tables work or how to put them into my patch in any way that works. I've seen plenty of users on here say how easy it is, but I've yet to read any instructions on the basics of how to use them.
the delay module is also a type of table.
For the ram type, the size of the table is set like "int32_t array[LENGTH]" where the length is set with the size attribute.
for the SDram type, inside the recording module, you have the "int32_t *array;" in "local" content, which is used as a table, where the length of the table is set in the "init" content.
you could see it like this:
you could create multiple "int32_t" by doing like,
int32_t a1,a2,a3,a4,a5,a6...... etc. allowing you to store a 32-bit value into each of these.
But, you could also just use one name and turn it into an array like this: int32_t a[6];
Which, in a sense, is just six 32-bit values in a row, which can be selected by entering a number between 0 and 5 between the brackets..
The table and delay modules both make use of these tables, although in a somewhat different way due to how the table is used.
The table arrays are often used such that, for the table-write module, you can select an index at the input side and put an incoming value somewhere at some index of the table. Then the table-read module has an input to select an index of the table and output the stored value from that index position.
The delay module works alike, except it has one important difference: the write and read positions are "coupled" as the delaytime is a position in comparison to the write position (it follows the writeposition at a certain distance).
So to have a 1 second delay at a 48000hz samplerate, you need to offset the read position by 48000 steps in comparison to the writeposition to read out the table at the position that was written 1 second or 48000 samples ago, by subtracting 48000 from the current writeposition.
This would look like this:
writepos=(writepos+1)&LENGTHMASK;
array[writepos]=inlet_input;
delayedsignal=array[(writepos-48000)&LENGTHMASK];
so the table is a set of int32_t values (or whatever bitsize you're using), which is constantly being overwritten to save the last incoming audio. The maximum size of the recording is set by the table length, after which the buffer is overwriting the values that were stored before, but at a time longer then the table can hold (eg. if your table size is 48000, you can only record 1 second, so after a second, it will overwrite the value that was recorded a second ago).
So to clear a delay, all you need to do is to set all these values inside the table to zero, so when they're being read, they just return "0".
The fact that you can use an index number makes it really easy to do:
if(off && ! (inlet_active))
{
off=1;
for(int i=0;i<LENGTH;i++)
{
array[i]=0;
}
}
else if(inlet_active){off=0;}
this sets all the values from i=0 up to i=length-1 of the "array" table to zero.