[sdiy] help understanding circular buffers for delay line

Martin Klang mars at pingdynasty.com
Sat Mar 3 20:15:56 CET 2012


why not use modulus?
inpos = (inpos + 1)  % length ;

no power-of-two limitation with that.

or how about something which you can look at and hope to understand, e.g.
if(++inpos == length)
   inpos = 0;

As for performance, don't optimise your code first, optimise your design.
Then if need be, find the bottle necks, compile and compare the assembly output. For the target platform.

For something like this, I would start with a library implementation such as this [1], and work from there.

just my £0.02,

/m

[1] http://www.boost.org/doc/libs/1_49_0/libs/circular_buffer/doc/circular_buffer.html


On 3 Mar 2012, at 04:22, Andrew Simper wrote:

> I'm not sure which number field you are on that 8000 is a power of 2,
> but back in regular flat number land you would need 8192 = 2^13, or
> any other power of 2, depending on how long you want the delay and
> your sample rate.




More information about the Synth-diy mailing list