Complex Nonlinearities Episode 5: Nonlinear Feedback Filters

Developing the Structure

Just like last time, we’ll be starting the with a Biquad Filter, in the “Transposed Direct Form II”. If these words don’t mean anything to you, please take a minute to read through the beginning of the previous article, where we discuss these concepts in more detail. You may recall that previously we added nonlinear elements just before each delay element, as shown below.

Transposed Direct Form II filter (left) with nonlinear elements before the delay elements (right)
Transposed Direct Form II filter with nonlinear feedback

Frequency Response

Like last time, let’s now take a look at what happens to the frequency response of the filter when we change the input gain. For this example, we’ll use a lowpass filter with a cutoff at 1 kHz, a Q of 10, and tanh clippers for our nonlinear elements.

Pole Analysis

I’m going take a small leap here, and try to do a little bit of math to show why the nonlinear filter reacts in this way. If the math isn’t making much sense, feel free to skip this section. First, we need to define a couple of things. If you’d like to see this derivation given with a more technical treatment, please check out this paper.

Filter Poles

The resonant frequencies of a filter are defined by it’s “poles”. These poles are complex values that show where the feedback of the filter reaches a maximum. To find the poles for a linear filter, we can use the quadratic formula on the a coefficients of our filter as defined in the Direct Form.

Nonlinear Gain

The next thing to consider is that a nonlinear function can also be written as a dependent gain. For example, the dependent gain for the tanh nonlinearity looks like this:

What happens to the poles?

Now for the million dollar question: what happens to the poles of the filter when we add the nonlinear elements? The basic answer is that the aa coefficients are multiplied by the dependent gain values. Then the new pole locations can be described by

Anti-Aliasing

As usual, it’s worth taking a minute to discuss that harmonic response of this system, and think about any aliasing problems we might have. To get a sense of that we’re dealing with, I’ve taken the example filter from earlier (cutoff = 1 kHz, Q = 10, nonlinearity = tanh), and plotted it’s harmonic response for a 100 Hz, and a 2kHz sine wave.

Examples

Once again, please check out an implementation of this nonlinear feedback filter as an audio plugin on GitHub. There’s also a video demo available on YouTube (see below). I was really surprised by how neat this filter sounded. The sort of “sweeping” effect of the moving pole is really unique, and I’m excited to experiment with this form a little bit more.

Finally…

Thanks once again, for reading through another episode of this series. I’d love to hear any uses you guys find for nonlinear filters of this sort, as well as where the inspiration from this article may lead you. Maybe there are other filter forms that sound even cooler under nonlinear feedback conditions like this!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store