Post Go back to editing

Variable band-stop / notch filters

For a feedback suppression algorithm I am looking to implement variable gain / rejection / frequency notch or band-stop filters.

On other words, I need to be able to control the center frequency and amount of rejection dynamically.

What would be the best way to implement this on an ADAU 1761?

  •      Hello Roman,

         Your final application will influence which of several approaches might work for you.  I'll try to describe these methods with their advantages and limitations.

         Second-Order IIR

         These are by far the most versatile and capable, but also the most difficult to control in real-time:

         Problem is, to adjust these filters at runtime you'll need an external means of control -- either SigmaStudio via the USBi, or a microcontroller in your final product.  This is because the five IIR coefficients needed to drive these filters have calculations too complex for a SigmaDSP to do on its own.  So instead you have your microcontroller calculate the needed coefficients for a desired response, then have it safeload them into the DSP's parameter memory via I2C or SPI bus.  I attached a spreadsheet with formulas to calculate coefficients for various filter types -- it's fairly straightforward to translate them into C code for your microcontroller.  To troubleshoot your own calculations, enter them into the IIR Coefficient version of the filter, as with the notch filter shown below:

         Once you've calculated your coefficients, safeloading them has been covered in various forum topics -- for example,

         State-Variable Filter

         This is the only SigmaStudio filter for which the DSP figures its own coefficients, thus allowing filter control to originate within a signal flow.  It has simultaneous lowpass, highpass, and bandpass outputs.  It's possible to create a notch by subtracting its bandpass output from the original signal, but tricky to obtain a deep notch this way.

         Communications-Grade Notch

         If your application is in communications with a narrow voice bandwidth, you can borrow an idea used in radio since the 1930's -- it's far easier to move the incoming signal's frequency than to move the filter's frequency.  See an example of this technique at

         Best regards,


  • Hi ,

    thank you! for your comprehensive answer!

    I got some important pointers from it - like dynamic calculation of coefficients not being possible on the DSP itself (what a shame btw!  Can't I do this by creating a multiplier/adder/divider network, even if that's tedious?).

    In the meantime I played around with all-pass-filters and adding their output to the original signal.  That will create a very narrow notch at the AP center frequency, as their phase response crosses 180° and thus the signals cancel out.  I can adjust the amount of cancellation by varying the respective magnituses of the AP and the original signal.

    This still leaves moving the center frequency issue to be resolved though.

    Best regards, Roman

  • Roman, there is another component that could work if you can live with stepped frequency centers (as opposed to a continuously variable frequency center):  the "IdxSelectable Indp. Multiple Band Filter" block.  This doesn't use too many instructions, just some parameter RAM for each set of filter coefficients.

    If you look at Bob's spreadsheet you'll see that filter coefficient calculation is very expensive for a SigmaDSP; it uses an exponent (I think those can be simplified if your filter doesn't vary in magnitude) and several trig functions, in addition to multiplication/division.  Since you don't need those calculations run for each sample (I hope!), it's better to have an MCU to manage that if required.

  •   Hi Roman & Jon.

        Thanks to , we have a way toward a 'voltage'-variable notch filter.  It starts with this idea:

         Cascading two of these first-order allpass filters gives us 180 degrees of shift at the set frequency.  Then we use Roman's idea of notch filter via mixing the before and after signals.  Adding a LUT to linearize its frequency control, and we're done!