## SVF filter saturation in feedback path / diode

DSP, Plug-in and Host development discussion.
xhy3
KVRist
58 posts since 19 Jan, 2014
I currently try to implement the saturated SVF filter from the book "The Art of VA Filter Design".
It has an antisaturator in the feedback path. The working equation for finding the BP value looks like this (https://www.discodsp.net/VAFilterDesign_2.1.0.pdf fig 6.49 page 213):

Code: Select all

``````(BP - s1)/g = x - ((R-1)* (g*((BP - s1)/g)+s1) + sinh(g*((BP - s1)/g)+s1)) * 2 - g*(g*((BP - s1)/g)+s1) - s2
``````
It works when i solve it. For some tests i did use mystran's pivot solution.

But sinh or tanh^(-1) lead to an unstable behaviour at high values because of the nature of the functions as described in the book. The filter blows up at higher resonance values where the filter would self oscillate.

The book describes a way to solve the equation or parts "reverse", so that sinh or tanh^(-1) can be replaced with the stable sinh^(-1) or tanh functions.

I tried a lot of things but wasn't able to solve the equation reverse. Can someone help and explain what this means and how this would be possible for the SVF?

Any other solutions to make this stable are also welcome.

xhy3
KVRist
58 posts since 19 Jan, 2014
Ok, i was able to use tanh instead of sinh (tanh^(-1)). I solved the equation for sinh(BP) = EQ and changed it to BP = tanh(EQ). This way i got the inverse and finally can use the stable tanh.

After that hard work i noticed that the filter is still not able to self oscillate Is this a normal behaviour for a SVF with a diode in the feedback path?

xhy3
KVRist
58 posts since 19 Jan, 2014
I found that self oscillation should work. It looks that the problem lies in the value i have used in the pivot method. The previous BP value was a bad choice to calculate the required damping. Let you know if i found a solution.

xhy3
KVRist
58 posts since 19 Jan, 2014
I found that self oscillation should work. It looks that the problem lies in the value i have used in the pivot method. The previous BP value was a bad choice to calculate the required damping. I have chosen s1 as a test and it worked pretty well. Super stable self oscillation.

Also i have to say i also see the advantages of SFV filters without self oscillation. It looks that you can reach a much higher resonance peak without getting into the, sometimes unwanted, self oscillation.

Let you know if i found a cleaner solution.

xhy3
KVRist
58 posts since 19 Jan, 2014
I think i stay with the s1 solution to calculate the pivot damping. I also want to thank again vadim for the great book and the idea of calculating the value revers.

Now i can use every saturation curve without caring about filter stability. It sweeps up super stable with float values and without oversampling. Just the aliasing produced by the nonlinearity hurts. But that was expected

Urs
u-he
24433 posts since 8 Aug, 2002 from Berlin
I was gonna try to find my Maple worksheet, but looks like you found the solution

mystran
KVRAF
5651 posts since 12 Feb, 2006 from Helsinki, Finland
xhy3 wrote:
Fri Jan 17, 2020 1:02 am
After that hard work i noticed that the filter is still not able to self oscillate Is this a normal behaviour for a SVF with a diode in the feedback path?
The band-pass feedback results in damping and in theory the filter self-oscillates when the BP feedback gain is zero. However with the diodes always conducting slightly, so the filter will never quite reach true self-oscillation, unless you actually force it with inverted feedback (which is not possible with a SEM-1a style setup with a resonance pot).

In practice, if you build the circuit, you might still see some self-oscillation at very high frequencies, which can probably be explained by non-ideal components (eg. excess phase from the op-amps or something).

As for the damping non-linearity: with the resistors around the diodes, you can't really take sinh() directly since once the diodes start conducting, the resistors will still limit the current. The result is basically linear feedback with the center smoothly squeezed out. Something like this:
Screen Shot 2020-01-17 at 13.58.31.png
Note that I'm ignoring the cap in order to just get a static non-linearity.

In practice, the exact shape of the non-linearity doesn't seem to be that critical, as it mostly just controls the behaviour of the resonance and you can actually vary the exact curve quite a bit without drastically altering the sound of the filter.
You do not have the required permissions to view the files attached to this post.
Please just let me die.

xhy3
KVRist
58 posts since 19 Jan, 2014
mystran wrote:
Fri Jan 17, 2020 4:19 am
xhy3 wrote:
Fri Jan 17, 2020 1:02 am
After that hard work i noticed that the filter is still not able to self oscillate Is this a normal behaviour for a SVF with a diode in the feedback path?
The band-pass feedback results in damping and in theory the filter self-oscillates when the BP feedback gain is zero. However with the diodes always conducting slightly, so the filter will never quite reach true self-oscillation, unless you actually force it with inverted feedback (which is not possible with a SEM-1a style setup with a resonance pot).

In practice, if you build the circuit, you might still see some self-oscillation at very high frequencies, which can probably be explained by non-ideal components (eg. excess phase from the op-amps or something).

As for the damping non-linearity: with the resistors around the diodes, you can't really take sinh() directly since once the diodes start conducting, the resistors will still limit the current. The result is basically linear feedback with the center smoothly squeezed out. Something like this:

Screen Shot 2020-01-17 at 13.58.31.png

Note that I'm ignoring the cap in order to just get a static non-linearity.

In practice, the exact shape of the non-linearity doesn't seem to be that critical, as it mostly just controls the behaviour of the resonance and you can actually vary the exact curve quite a bit without drastically altering the sound of the filter.
Thanks for the answers. Also thanks to urs for taking the time to look at it

Too bad that the SEM a1 didn't self oscillate(especially when used in a synth), but if i understand that right they were able to self oscillate and stay stable when forced with a high resonance value(a negative one)?

Good to hear that the shape of the saturation curve does not make a huge difference. Maybe it does in my example because i'm using s1 at the moment for calculating the saturation intensity for the pivot method. It seems that the saturation curve in my example affects the overtones (distortion) while the filter is in self oscillation. Without resonance it maybe does not change the sound at all (just the phase).

Interesting plot with the resisters around the diodes. The squeeze around zero really hurts... is this LTSpice?

mystran
KVRAF
5651 posts since 12 Feb, 2006 from Helsinki, Finland
Yeah, the plot is from LTSpice. The point though is that the diodes act like "smooth switches" and the resistors control the actual damping when the diodes conduct. For small signals the diodes don't conduct and the only damping is through the other path with the resonance pot.
Please just let me die.

xhy3
KVRist
58 posts since 19 Jan, 2014
mystran wrote:
Sun Jan 19, 2020 3:45 pm
Yeah, the plot is from LTSpice. The point though is that the diodes act like "smooth switches" and the resistors control the actual damping when the diodes conduct. For small signals the diodes don't conduct and the only damping is through the other path with the resonance pot.
Thanks for getting back. So this is expected. I will try to reproduce this. I wonder how this affects the audio spectrum. I can imagine that it produces some interesting frequencies.

2DaT
KVRist
409 posts since 21 Jun, 2013
Maybe slightly off-topic, but SVF with diodes in feedback can be solved analytically with LambertW and logarithm (assuming only 1 diode conducts at a time, but that's reasonable).

LambertW(e^x) approximation is not too expensive (2-4 e^x), but the funny thing is that it uses Newton method (1 or 2 iterations). You can cut the middle man and use Newton directly, but it's probably easier to guarantee convergence in presence of rounding errors, because LambertW(e^x) can be tested.

The second thing is that analytical solution does have aliasing, and you still need to oversample, which defeats the purpose, because iterative methods converge better when oversampled.

The third thing is that mystran's pivot method sounds the same to me as more complicated methods (Newton, analytic). I only tested SVF with single mild non-linearity, maybe it doesn't work that well in different topologies.

Z1202
KVRian
1147 posts since 12 Apr, 2002
2DaT wrote:
Mon Jan 20, 2020 4:27 pm
The third thing is that mystran's pivot method sounds the same to me as more complicated methods (Newton, analytic). I only tested SVF with single mild non-linearity, maybe it doesn't work that well in different topologies.
I think the differences should become more obvious at excessive settings (large cutoffs and strong feedback/resonance), where the nonlinear aspects become really strong within in the instantaneous equations.

Z1202
KVRian
1147 posts since 12 Apr, 2002
2DaT wrote:
Mon Jan 20, 2020 4:27 pm
(assuming only 1 diode conducts at a time, but that's reasonable)
Intuitively I tend to agree, if the signal levels and other parameters are quantitatively comparable to what's happening in the electric circuit. However I'd be interested in a proper estimation of the effect of the arising discontinuity on the signal (what are the factors affecting the prominence of the effect, and how big is there respective contribution). I'm too loath to do that myself ATM

I mean, otherwise we could e.g. also assume that the diodes either conduct or not (switching effect), and have an even simpler equation

Edit: actually, just realized that the curves already go through the origin. For whatever reason I was thinking that the diode's current is nonzero for zero voltage. :facepalm: :headbang:

mystran
KVRAF
5651 posts since 12 Feb, 2006 from Helsinki, Finland
xhy3 wrote:
Sun Jan 19, 2020 12:57 pm
Too bad that the SEM a1 didn't self oscillate(especially when used in a synth), but if i understand that right they were able to self oscillate and stay stable when forced with a high resonance value(a negative one)?
Let me try to explain this properly.

The transfer function is simply (a2*s^2+a1*s+a0*1)/(s^2+s/Q+1) where a2,a1,a0 are simply the gains you take from hp, bp and lp outputs. The denominator is what we are interested in.

We can rewrite R=1/Q where R is the BP feedback gain (my definition might be slightly different from Vadim's, but I feel like simple R=1/Q is the easiest to work with). As R goes to zero, the Q goes to infinity and for a linear filter, self-oscillation happens when R=0 -> Q=inf.

To get "forced self-oscillation" with any filter (which is unstable for linear filters), you want Q to be slightly "higher than infinity" which sounds funny, but sort of makes sense if you think in terms of extended real-line or extended complex-plane wrapping around through the point at infinity. As it turns out, in terms of R this happens simply when we cross zero and R becomes slightly negative. We can't do this by using a SEM-style variable resistor divider to ground, but it can be done even in analog with an extra inverting amplifier.

Now, in the SEM-style SVF the resonance pot (which is a variable divider to the ground) controls the feedback R when the BP signal amplitude is low. When the amplitude grows, the (separate) diode path (which we will assume is independent of the actual resonance setting) will pass-thru some additional damping to increase R and therefore decrease Q.

With the simple pot in the original R is basically limited to about [0,3]. The zero feedback when the resonance pot goes to ground. The factor of 3 happens because the main resonance path with pot turned to connect BP directly has only 33k resistor while the inverting HP opamp has 100k local feedback (hence gain of 100k/33k).

It is obviously trivial to vary R over a larger range in software, so if we take it to a slightly negative value, we get forced self-oscillation. If we assume the only actual non-linearity is the additional damping from the diode path, then the large-signal BIBO stability limit for self-oscillation is where the additional damping from the fully conducting diodes barely cancels out the main feedback with negative R.

In other words, with the diodes fully conducting, the combined damping must still be positive, but if the damping is negative at low amplitudes (when the diodes don't conduct), then the filter will regenerate until the amplitude is high enough that the diodes will start conducting enough to damp out additional regeneration.

Hopefully this clears up any confusion.
Please just let me die.

mystran
KVRAF
5651 posts since 12 Feb, 2006 from Helsinki, Finland
I want to additionally note that the above is a decent description of how the circuit works over most of the audio range, when we can mostly neglect the feedback caps and any less-than-ideal behaviour of the OTAs, OPAs and the buffer transistors. In practice, if you build the actual circuit you might notice a bunch of other oddities, especially at extreme cutoff settings (both high and low), but I would argue that these are probably not worth worrying about unless you want to go all the way with component-level simulation. YMMV.
Please just let me die.