ΣSigmaStudio Ask AI Русский Log in

Variable band-stop / notch filters

SigmaDSP & SigmaStudio klangmeister Jun 10, 2015 00:00 5 replies Original on forum ↗
Thread Summary

Thread Summary

The user seeks to implement dynamic variable gain/frequency notch filters on the ADAU1761 for feedback suppression. The final answer suggests using second-order IIR filters, controlled by an external microcontroller to calculate and safeload coefficients, or a state-variable filter for simpler, though less deep, notches. An alternative is the 'IdxSelectable Indp. Multiple Band Filter' block for stepped frequency centers, which is less computationally intensive.
AI Generated Content
Subscribe
klangmeister Question
Jun 10, 2015 00:00

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?

KJBob Reply
Jun 12, 2015 00:00

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, https://ez.analog.com/message/61175#61175

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 https://ez.analog.com/message/173545#173545

Best regards,

Bob

2502.57aa72cffe90c7a60812f0a42289c566.png
2502.57aa72cffe90c7a60812f0a42289c566.png
2502.57aa72cffe90c7a60812f0a42289c566.png-620x406.png
2502.57aa72cffe90c7a60812f0a42289c566.png-620x406.png
3007.db28dea8dfe630300c1661cc39d4339d.png
3007.db28dea8dfe630300c1661cc39d4339d.png
3007.db28dea8dfe630300c1661cc39d4339d.png-620x290.png
3007.db28dea8dfe630300c1661cc39d4339d.png-620x290.png
KJBob Reply
Jun 12, 2015 00:00

The spreadsheet is attached below

klangmeister Reply
Jun 15, 2015 00:00

Hi KJBob,

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

jon71 Reply
Jun 16, 2015 00:00

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.

KJBob Reply
Nov 7, 2015 00:00

Hi Roman & Jon.

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

https://ez.analog.com/message/224892#224892

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!

Bob

3122.b5e91b534776ea972ca9d5f967c331db.png
3122.b5e91b534776ea972ca9d5f967c331db.png
3122.b5e91b534776ea972ca9d5f967c331db.png-620x296.png
3122.b5e91b534776ea972ca9d5f967c331db.png-620x296.png