Cheap non-linear zero-delay filters

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Marvinh wrote: Thu Dec 05, 2024 12:53 am It is iterating to a solution every time I call the Lambertw I am trying to prevent that with a cheaper guess or do it all in one iteration or split to 2 and 4 series
I'd probably forget Lambert W and if you actually need to solve this on the fly (ie. not just approximate with a pre-computed wave-shaper) then iterate the MNA matrix with Newton directly... but a lot of people seem convinced that Lambert W is somehow useful, so please don't listen to me (just.. don't use a Lambert W implementation that runs NR anyway; that's just pointless).

I kinda doubt the pivot-trick would work here. You could take a different approach and lump the transistors in equation (15) based on exp(v)+exp(-v)=2*cosh(v) rather than going lambda, which in principle gives you a nice function to approximate, but given that the overall response of the shaper is non-monotonic, I suspect you might run into some stability issues.

Post

mystran wrote: Thu Dec 05, 2024 6:42 am
Marvinh wrote: Thu Dec 05, 2024 12:53 am It is iterating to a solution every time I call the Lambertw I am trying to prevent that with a cheaper guess or do it all in one iteration or split to 2 and 4 series
I'd probably forget Lambert W and if you actually need to solve this on the fly (ie. not just approximate with a pre-computed wave-shaper) then iterate the MNA matrix with Newton directly... but a lot of people seem convinced that Lambert W is somehow useful, so please don't listen to me (just.. don't use a Lambert W implementation that runs NR anyway; that's just pointless).

I kinda doubt the pivot-trick would work here. You could take a different approach and lump the transistors in equation (15) based on exp(v)+exp(-v)=2*cosh(v) rather than going lambda, which in principle gives you a nice function to approximate, but given that the overall response of the shaper is non-monotonic, I suspect you might run into some stability issues.
Okay awesome thank you appreciate it posted more info in "multiple unknown" thread if you want to take a look. the exp(v)+exp(-v) more closely was resembling the ltspice then lambertw version

Post

Before I attempt and likely fail to reinvent the wheel, who among us has already applied this to a Sallen-Key filter?

Post

Dogue wrote: Thu Jun 05, 2025 4:45 pm Before I attempt and likely fail to reinvent the wheel, who among us has already applied this to a Sallen-Key filter?
Works fine (at least the "late MS20" variant with OTA stages).

Post

Sure, easy.

I found it's not working so well with anti-saturators (Oberheim-style SVF), but maybe also I haven't tried hard enough. Those however converge quickly with Newton Raphson, so...

Post

Urs wrote: Thu Jun 05, 2025 5:19 pm I found it's not working so well with anti-saturators (Oberheim-style SVF), but maybe also I haven't tried hard enough. Those however converge quickly with Newton Raphson, so...
Assuming "anti-saturator" refers to the diode-path in SEM-1A it does work reasonably well for that as well, although I'd suggest experimenting with the conductance curve (the theoretical curve is not necessarily ideal).

Post

mystran wrote: Thu Jun 05, 2025 5:31 pm
Urs wrote: Thu Jun 05, 2025 5:19 pm I found it's not working so well with anti-saturators (Oberheim-style SVF), but maybe also I haven't tried hard enough. Those however converge quickly with Newton Raphson, so...
Assuming "anti-saturator" refers to the diode-path in SEM-1A it does work reasonably well for that as well, although I'd suggest experimenting with the conductance curve (the theoretical curve is not necessarily ideal).
I'll expand on this a bit... you probably don't want the conductance to get too high (ie. something like sinh() would just explode), rather what you want to do is keep it close to 0 below the knee, then ramp it up to some suitable value (let's say 1 for simplicity).

As a starting point, a reasonable (and very cheap, but still somewhat reasonable sounding) non-linearity "conductance function" here would be (x^8)/(1+x^8) which keeps the conductance zero for low amplitudes and then smoothly ramps it up to 1 beyond +/-1, https://www.desmos.com/calculator/f0neutziia.

ps. If you multiply the above by "x" then we'll see that this is sort of "sinh-like" except it clips to "series resistance" of sorts.. you could use a more complicated functions to try and avoid the somewhat ugly shape, but in practice it doesn't necessarily make a huge difference in terms of sound as the sharpness of the initial knee (once we start passing signal) tends to be more important.

Post

I like sinh(x) because it's so easy to calculate and build a derivate (cosh(x)) from just one reasonably accurate approximation of e^x. So it's super well suited for NR. It converges rather quickly.

I'd combine this with the pivotal method on the forward path.

Post

Urs wrote: Thu Jun 05, 2025 7:14 pm I like sinh(x) because it's so easy to calculate and build a derivate (cosh(x)) from just one reasonably accurate approximation of e^x. So it's super well suited for NR. It converges rather quickly.
Sure, but my point is that the cheap approach does work perfectly fine as long as you lump both the diodes and the series resistance (or think directly in voltage; input opamp is an inverting unity gain amplifier with 100k feedback as there's 100k series resistance on every path, although the diode clipper actually has a bit more due to the 47k vs. 10k resistor divider, so won't actually ever reach unity gain... but that's .. not terribly important as far as whether or not the technique works).

Post Reply

Return to “DSP and Plugin Development”