Cheap non-linear zero-delay filters
- KVRAF
- 12615 posts since 7 Dec, 2004
which positive effects?
the code basically just computes the state of the fourth integrator, then computes the others in reverse from that. you can actually re-compute the fourth after the other three again for a slightly different effect.
the f*g powers are the exponential history of the inputs from the other integrators.
you can actually remove quite a lot of expense but having to re-normalize everything adds a ton of extra multiplications. it's not too much more expensive than other methods for similar results in the linear case and the powers can be computed by re-arranging the order to make them serial, but... i don't see the advantage.
the code basically just computes the state of the fourth integrator, then computes the others in reverse from that. you can actually re-compute the fourth after the other three again for a slightly different effect.
the f*g powers are the exponential history of the inputs from the other integrators.
you can actually remove quite a lot of expense but having to re-normalize everything adds a ton of extra multiplications. it's not too much more expensive than other methods for similar results in the linear case and the powers can be computed by re-arranging the order to make them serial, but... i don't see the advantage.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
The positive effects of being able to add "zero delay" and "topology preserving" to my marketing blurbs?aciddose wrote:which positive effects?
But seriously, don't we expect more accurate tuning and a more correct location of the resonant peak relative to the cutoff slope?
Only empirical results matter to me. I'll let you know what my ears and analyzers tell me.
the code basically just computes the state of the fourth integrator, then computes the others in reverse from that. you can actually re-compute the fourth after the other three again for a slightly different effect.
the f*g powers are the exponential history of the inputs from the other integrators.
you can actually remove quite a lot of expense but having to re-normalize everything adds a ton of extra multiplications. it's not too much more expensive than other methods for similar results in the linear case and the powers can be computed by re-arranging the order to make them serial, but... i don't see the advantage.
- KVRAF
- 12615 posts since 7 Dec, 2004
nope. once you add any variability to the saturation or modify the feedback tuning goes all out of whack. same thing happens in an analog filter. tuning actually depends upon the level when you're non-linearly shaping the feedback, you already know all this.AdmiralQuality wrote: But seriously, don't we expect more accurate tuning and a more correct location of the resonant peak relative to the cutoff slope?
hm, well mine said "Barf".Only empirical results matter to me. I'll let you know what my ears and analyzers tell me.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
Music Engineer Music Engineer https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=15959
- KVRAF
- 4378 posts since 8 Mar, 2004 from Berlin, Germany
c'mon guys, we get code that solves a problem that most of us here consider hard, on a silver plate, essentialy free to use, along with rather detailed explanations of how it was derived. definitely nothing to complain about. i say a big thanks to mystran (once again).
-
Richard_Synapse Richard_Synapse https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=245936
- KVRian
- 1187 posts since 20 Dec, 2010
Ideally the filter would become linear where needed, but this could get quite difficult to implement.aciddose wrote:well it is for me. the tanh result sounds horribly muddy. there are many other ways to apply the saturation characteristic to this filter (or any other) and for me the two most important factors are expense and aliasing. aliasing being way more important than expense.
Richard
Synapse Audio Software - www.synapse-audio.com
-
AdmiralQuality AdmiralQuality https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=83902
- Banned
- 6657 posts since 10 Oct, 2005 from Toronto, Canada
If it was that last clip you posted on SoundCloud last night, I agree!aciddose wrote:hm, well mine said "Barf".Only empirical results matter to me. I'll let you know what my ears and analyzers tell me.
- KVRAF
- 12615 posts since 7 Dec, 2004
that was a quick test of variations. a lot of wasp fans would disagree too, even though i agree.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
- KVRAF
- 12615 posts since 7 Dec, 2004
how so? i posted the linear version.Richard_Synapse wrote:Ideally the filter would become linear where needed, but this could get quite difficult to implement.
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
-
Richard_Synapse Richard_Synapse https://www.kvraudio.com/forum/memberlist.php?mode=viewprofile&u=245936
- KVRian
- 1187 posts since 20 Dec, 2010
Yes but I was referring to the nonlinear one, with saturation in all stages. I meant that ideally it would reduce aliasing automatically where needed, by somehow blending towards a more linear version.aciddose wrote:how so? i posted the linear version.Richard_Synapse wrote:Ideally the filter would become linear where needed, but this could get quite difficult to implement.
Richard
Synapse Audio Software - www.synapse-audio.com
- KVRAF
- 12615 posts since 7 Dec, 2004
right you mean like how i suggested you interpolate between the result and 1?
or how about replacing the tanh approximation with a simple 1-0.25*abs(x) and scaling the 0.25 part?
these are the easy things to solve. we need to discuss the hard parts.
- general explanation of the integrator and the summation of hysteresis to calculate half the state
- application of this to a generalized template
- use of this template to reproduce the 4-pole, and it's application to 2-pole sallen-key and chamberlain
- technicalities
- various methods of implementation that don't suck
- optimization
or how about replacing the tanh approximation with a simple 1-0.25*abs(x) and scaling the 0.25 part?
these are the easy things to solve. we need to discuss the hard parts.
- general explanation of the integrator and the summation of hysteresis to calculate half the state
- application of this to a generalized template
- use of this template to reproduce the 4-pole, and it's application to 2-pole sallen-key and chamberlain
- technicalities
- various methods of implementation that don't suck
- optimization
Free plug-ins for Windows, MacOS and Linux. Xhip Synthesizer v8.0 and Xhip Effects Bundle v6.7.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
The coder's credo: We believe our work is neither clever nor difficult; it is done because we thought it would be easy.
Work less; get more done.
- KVRist
- 469 posts since 6 Apr, 2008
You can travially remove any saturator by setting the corresponding gain t0,...,t1 to 1. Also, you can simply scale any saturator (i.e. change clipping threshold) to 1/a*tanh(a*x) by writingAdmiralQuality wrote:I do hope I can understand mystran's code enough to remove the saturators but keep the positive effects. Haven't tried yet... might get to it tonight.
Code: Select all
double t1 = tanhXdX(a*s[0]);- KVRAF
- Topic Starter
- 8476 posts since 12 Feb, 2006 from Helsinki, Finland
Yes, I forgot to mention this. That's how I bias my non-linearities since it lets me keep the linear model as-is.karrikuh wrote:You can travially remove any saturator by setting the corresponding gain t0,...,t1 to 1. Also, you can simply scale any saturator (i.e. change clipping threshold) to 1/a*tanh(a*x) by writingAdmiralQuality wrote:I do hope I can understand mystran's code enough to remove the saturators but keep the positive effects. Haven't tried yet... might get to it tonight.Code: Select all
double t1 = tanhXdX(a*s[0]);
- KVRian
- 1091 posts since 8 Feb, 2012 from South - Africa
You could in theory - do the non-linearity as an 'instant' feedforward compressor with a slight knee - that would be linear - where you want it to be, but would be expensive. For practical purposes I'd rather use something like tanh(sinh(x)) - 'cause it has a slightly more linear response, and the inter-harmonic relationships vary slightly vs. level. Also as mystran pointed out somewhere in this thread(I think) - you might want set the bias-level of feedback limiter lower than that of the intergrators, and if you follow AdmiralQuality's advice of setting the feedback bias-level at 200% - then you should set the intergrators' bias-level at about 250%. This actually makes sense - from an analog perspective - the feedback-limiter actually 'protects' the integrators in the loop.Richard_Synapse wrote: Ideally the filter would become linear where needed, but this could get quite difficult to implement.
Richard
Jut my 2cents.
Andrew
- KVRian
- 1091 posts since 8 Feb, 2012 from South - Africa
Random Note:
If you want to go old-school inductor based filter - google:
DIGITAL IMPLEMENTATION OF MUSICAL DISTORTION
CIRCUITS BY ANALYSIS AND SIMULATION
The Trapezoidal Rule and Backwards Euler formulas are on the very last page.
Also the Trapezoidal Capacitor - seems to match mystan's equation exactly.
If you want to go old-school inductor based filter - google:
DIGITAL IMPLEMENTATION OF MUSICAL DISTORTION
CIRCUITS BY ANALYSIS AND SIMULATION
The Trapezoidal Rule and Backwards Euler formulas are on the very last page.
Also the Trapezoidal Capacitor - seems to match mystan's equation exactly.
- KVRAF
- Topic Starter
- 8476 posts since 12 Feb, 2006 from Helsinki, Finland
If you mean like clip the feedback at lower level, then yeah that can give you cleaner sound without increasing self-oscillation level. It'll make things more subtle though, so if you really want clean sound, I'd just drop the extra non-linearities..Ichad.c wrote: Also as mystran pointed out somewhere in this thread(I think) - you might want set the bias-level of feedback limiter lower than that of the intergrators

