[sdiy] help understanding circular buffers for delay line
Dan Snazelle
subjectivity at hotmail.com
Fri Mar 2 02:57:12 CET 2012
On Mar 1, 2012, at 8:33 PM, "John Speth" <jspeth at avnera.com> wrote:
>> can anyone here help me understand the basics of writing a circular
> buffer
>> delay line?
>
> In C, the code emitted are usually the same when it applies to indexed
> arrays (like val = array[i++]) and pointers (line val *ptr++). Various
> compiler/chip combos probably vary but the good ones don't.
>
> A circular buffer is just a block of memory for storing your samples.
> You make it "circular" by "wrapping" the index as it goes past the end
> of the buffer proceeding through it (as in "i++; if (i >= SIZE) i = 0;).
>
>
> Your delay line will have a put index and a take index. The put index
> will point to the sample array position to which you'll store your ADC
> sample. The take index will point to the sample array position from
> which you'll read out your delayed sample. Usually these put and take
> operations happen at the same time (synchronously). In delay lines, the
> take index always chases the put index (but never catches up). Put and
> take indices will always increment by 1 for each put and take (taking
> into account wrapping).
>
> You need to take it from concept to building blocks to a final useful C
> module. I think your example was a bit too much for simplicity (the
> VDELAY structure) but it had all the important elements.
>
> The fun with delay lines happens when you have more than one take index
> and you sum scaled take samples back into the put sample (echo, reverb,
> etc). Vary the take rate and you get vibrato. Feedback that and you
> get flanging.
>
> JJS
>
>
That code went right over my head...it was from a good book but so far, it isnt making any sense
So, these two indexes....are they both driven by "for" loops?(one with an offset?)
How do you feedback the audio so you get a real delay?
Thanks
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at dropmix.xs4all.nl
> http://dropmix.xs4all.nl/mailman/listinfo/synth-diy
>
More information about the Synth-diy
mailing list