Help understanding flanger/chorus DSP implementation

Hi C5505 forum,

I have been working with my C5505 EzDSP to implement DSP audio effects and apart from basic delay and reverb algorithms I have succesfully implemented a 5-band parametric equalizer. I have found a lot of information regarding other delay-based audio effects such as flanger/chorus which I have been trying to implement and although I get a chorusy effect I hear kind of crackling noise as well.

I'm using a LFO (1 Hz sine waveform)  that modulates a 480 sample delay buffer. Here's what I do:

  • For each sample the program calculates the actual sinewave value. I'm using the sinewave generator written by TI's Richard Sikora, which outputs only integer values. This sinewave has a pk to pk value of 480.
  • Read the current circular buffer value given by the sinewave generator starting at buffer_length/2 (in this case 240). Compute the algorithm value.
  • Write at the current circular buffer position.

I think that the problem occurs once the algorithm gets a N=0 delay value since the buffer is full of samples and as soon as it starts incrementing again it reads this wrong values instead of reading a blank buffer space.

So do I have to clear the buffer once the program gets to the "bottom" of the buffer? Or am I missing something else?

Thanks in advance!

1 Reply

  • Hello Luis,

    @ "although I get a chorusy effect I hear kind of crackling noise as well" -

    *Typically* integer movements of read/write pointers through a simple circular buffer implementation (to mimic the time-varying nature of the delay tap-lines, which in turn produces these effects) lead to some undesired 'click' or modulation noises. The 'delay' element will have to be continuous & for that you'd need fractional delay lines (or something like the linear interpolators out of an SRC).

    Why don't you try some first order interpolation? read 2 input samples and then use the (computed) average of the 2 values for your algorithm's delay line inputs. It's sort of like the computationally cheaper cousin of implementing a full fledged fractional delay line.

    Chorus, as you might know,  is a variation on the theme of 'flange-ing'. Flange-ing, if you're a classic rock fan, originated with delaying the motor speed of one of the two 'mono' playback heads (which were playing identical copies in sync), feeding a third recording-tape. It's all in "delaying" & the amount of delay matters quite a bit to get the desired effect. The key, though, is to get the circular buffer to operate like a continuous delay line.

    Hope that helps. Good luck.


    I can't listen to that much Wagner. I start getting the urge to conquer Poland.