Cheap non-linear zero-delay filters

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

Post

urosh wrote:No, you are right. There is never ever ever instantenous blowup or instantenous anything in analog domain.
However, Vadim was examining different case (at least how I understand it). It's situation where you apply positive feedback in linear contionus time system. Instantenous instability is actually expected consequence of idealised contionus model. if you have system described as y(t) = x(t) +a*y(t) and you increase a from 0 y(t) will blow up (undefined actually) when a reaches 1. So, it's not behavior of discrete model, it's in nature of linear contionus model.
Actually I was referring to the cases where there is no instantaneous blowup in the analog model, but the respective digital model results in the instantaneous blowup (due to limitations of the trapezoidal integration).

Post

Z1202 wrote:Actually I was referring to the cases where there is no instantaneous blowup in the analog model, but the respective digital model results in the instantaneous blowup (due to limitations of the trapezoidal integration).
True that. I was thinking about image where only gain g remained of whole model, but completely forgot that in analog equivalent there is still integrator in the loop. There is contionus system that instanly blows up but you were not examining that situation. That is, in contious case with positive feedback around inegrator we get exponential blow up, not instantenous.

Post

Do you guys think it's worth the trouble to make a zero-delay feedback envelope follower? Would the attack be faster?

Post

no. there would be absolutely no benefit at the rates you'd be interested in. 200hz or so.

the attack can't be faster than instantaneous, which you can achieve with the naive method.
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.

Post

Ichad.c wrote:Do you guys think it's worth the trouble to make a zero-delay feedback envelope follower? Would the attack be faster?
You mean like envelope follower in a feedback compressor? Seems like a sensible thing to do.. not really for faster attack. I don't see why you would want very fast attack anyway; somewhere in the millisecond range is usually quite enough to totally kill all dynamics, but in some cases the extra delays could have slight effects on the dynamics. Also for time-domain stuff BLT isn't necessarily ideal; you might want to try impulse invariant or something instead.

Post

i've wanted to have zero-delay feedback compressor (inspired by the threads about zero delay filters..) and i tried to think of how to make it - but i failed
the only thing i could think of is the old "delay the input with 1 sample and report it to the VST host"

having Zero (or near-zero) attack and release times is good cuz it turns into a phunky distortion (at least it sounds cool to me)
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

I'm a little bit late for the party, but got some general question to help me understand this.
mystran wrote: I'm not going to concern myself with BLT other than note that since this is based on trapezoidal integration, and since I'm using TDF2 BLT integrators as building blocks, we can tune filters exactly in cases where the non-linearities are negligible (which is to say that I'm not going to discuss what happens when the non-linearities force the cutoff to change and we're in a seriously warped region of the BLT frequency scale). Namely, the form of integrator building block I'm using is:

Code: Select all

y[n+1] = s[n] + f*x[n]
s[n+1] = 2*f*x[n]

 where
  x[n], y[n] and s[n] are input, output and state

 and the tuning that maps the normalized analog frequency 1
 to whatever frequency we want is
  f = tan(M_PI * freq / samplerate)
here is the first thing I don't get.
When I have a look at Vadims THE ART OF VA FILTER DESIGN book, the basic trapezoidal integrator in TDF2 (Figure 3.10 + Equ. 3.11) seems to be

Code: Select all

y[n] = f*x[n] + s[n-1]; 
s[n] = f*x[n] + y[n]; 
the same integrator is used in the SVF implementation from Robin

how do you get to your s[n+1] = 2*f*x[n] version?
if I substitute the y[n] in the second equation with the first I get:

Code: Select all

s[n] = f*x[n] + y[n]; 
=> s[n] = f*x[n] + f*x[n] + s[n-1];
=> s[n] = 2*f*x[n] + s[n-1];
mystran wrote: *snip*

This leads to:

Code: Select all

y[n+1] = s[n] + f * T(x[n] - y[n+1]) * (x[n] - y[n+1])
The point of this exercise is that we can now treat the non-linear transconductance and the actual input separately. So what we can do, is combine Euler method for the non-linearity with trapezoidal method for the linear part! In alternative interpretation we delay the transconductance by half a sample. Recall that s[n] = y[n+0.5]. For consistency, use x[n-0.5]=0.5*(x[n]+x[n-1]) for the actual input signal; everything else is available from one of the filter states:

Code: Select all

y[n+1] = s[n] + f * T(x[n-0.5] - s[n]) * (x[n] - y[n+1])
Now the feedback dependence is linear, so we can implement this as::

Code: Select all

 t = T(0.5*(x[n] + x[n-1]) - s[n])
 y[n+1] = (s[n] + f*t*x[n]) / (1 + f*t)
 s[n+1] = s[n] + 2*f*t*x[n]
Here, again, I don't get how you derive the s[n+1] equation.
y[n+1] is clear.

in the original integrator we have

Code: Select all

y[n+1] = s[n] + f * x[n]
now we replace the input x[n] with the '(tanh(vIn)/vIn )' part as input

Code: Select all

y[n+1] = s[n] + f * tanh( x[n] - y[n+1] )
=> y[n+1] = s[n] + f * T(x[n] - y[n+1]) * (x[n] - y[n+1])
=> y[n+1] = s[n] + f * t * x[n] - f * t * y[n+1]
=> y[n+1] + f * t * y[n+1] = s[n] + f * t * x[n] 
=> y[n+1] * (1 + f*t) = s[n] + f * t * x[n] 
=> y[n+1]  = (s[n] + f*t*x[n]) / (1 + f*t)
and voilà we've got the new y[n+1] equation for the OTA
but where does the 's[n+1] = s[n] + 2*f*t*x[n]' equation come from?

trying the same with the s[n+q] equation doesn't work. not sure if this is even needed or the right thing to do

Code: Select all

we want to arrive at:
s[n+1] = s[n] + 2*f*t*x[n]

so the original integrator
s[n+1] = 2*f*x[n] 
replace input
s[n+1] = 2*f* tanh( x[n] - y[n+1] )
=> s[n+1] = 2 * f *T(x[n] - y[n+1]) * (x[n] - y[n+1])
=> s[n+1] = 2 * f * t * (x[n] - y[n+1])
=> s[n+1] = 2 * f * t * x[n] - f * t * y[n+1]

and we have an additional '- f * t * y[n+1]' I can't get rid of.
so where is my mixup?

Thanks for any help, godda wrap my head around this finally!

cheers,
Nemuri

Post

Nemuri wrote:I'm a little bit late for the party, but got some general question to help me understand this.
mystran wrote:

Code: Select all

y[n+1] = s[n] + f*x[n]
s[n+1] = 2*f*x[n]

 where
  x[n], y[n] and s[n] are input, output and state

 and the tuning that maps the normalized analog frequency 1
 to whatever frequency we want is
  f = tan(M_PI * freq / samplerate)
here is the first thing I don't get.
When I have a look at Vadims THE ART OF VA FILTER DESIGN book, the basic trapezoidal integrator in TDF2 (Figure 3.10 + Equ. 3.11) seems to be

Code: Select all

y[n] = f*x[n] + s[n-1]; 
s[n] = f*x[n] + y[n]; 
Oh right.. so it should be s[n+1]=s[n]+2*f*x[n].
Observe that if you have:

Code: Select all

y[n] = f*x[n] + s[n-1]; 
s[n] = f*x[n] + y[n];
 with substitution of y[n]:
s[n] = f*x[n] + f*x[n] + s[n-1]
So it's supposed to be the same thing, just written in a different way. I'm surprised nobody else noticed that, but it's a "typographic" error. The later formulas all use the correct form, hence the "missing term" that you observe.

... I'll fix it to the original post.

Post

Ichad.c wrote:A random Q that has been bugging me...
Why is Trapezoidal Rule chosen in these situations? I've seen in papers (in the simple capacitor and inductor case) that some use Backwards Euler.
So what's the difference/drawbacks between the two?
In short Trapezoidal integration is energy preserving in the perfectly linear case. When stiff non-linearities are at play then these can push you over the edge and make things blow up. Backwards Euler dissipates energy, so it is more stable, but this will ruin things like self oscillation tracking over frequency. If you imagine a quadrature oscillator being integrated, the x and y values transcribes a circle: Trapezoidal integration will keep you on the circle (within the limits of numerical precision), the Backwards Euler will spiral you towards the centre, but by a different amount depending on the frequency you are spinning.

For more information I recommend Gil Strang's videos on Computational Science And Engineering. There are many different numerical integration methods, each of which has advantages and disadvantages.
http://ocw.mit.edu/courses/mathematics/ ... fall-2008/
The Glue, The Drop, The Scream - www.cytomic.com

Post

mystran wrote:
Richard_Synapse wrote:From what I can tell from a real OTA ladder filter, the nonlinearity is not tanh. For the diode clipper it's most likely the wrong model to choose as well. Of course it may sound perfectly fine, just saying unlikely to be 100% authentic if that's what you're after.
Like I tried to point out (perhaps not explicitly enough) it depends on the OTA.

For something like CA3080 (or even LM13700 as long as you leave the diode linearization unconnected) tanh() is quite reasonably model, since the whole this is just another long-tailed pair plus a few current mirrors. So if you built an OTA ladder with 4x CA3080 for the stages and another for the resonance control, then you should get roughtly tanh() all the way.

Ofcourse, most OTA cascades in the wild are not built out of CA3080s, but something like CEM3320 so the question of "what are the correct non-linearities" then becomes "how are the CEM3320 gaincells implemented".
I can back Mystran here, The CA3080 class of devices (eg CA3280 / LM13600 / LM13700) is most certainly very close to a Tanh funciton, to within -90 dB or so. I have not analysed the CEM3320, but if anyone wants to point me towards a schematic I'll be happy to :)
The Glue, The Drop, The Scream - www.cytomic.com

Post

Mystran: I want to thank you for sharing the first truly new and innovative predictor method to solving non-linear systems I have seen in a long time, and especially one that looks great for audio use. All work thus far I have read on different methods for solving these problems was either old or just regurgitating already know things where the only thing new was their own nomenclature, but this looks like a really new and cool idea. I can't wait to do some error analysis of this method as a predictor vs other available methods. Getting a solid initial guess to the solution is critical for low cpu use.

PS: in reading your posts over the past few years I pegged you as someone that was smart and very technically switched on, this really proves it. Very few people for me fit into this category.
The Glue, The Drop, The Scream - www.cytomic.com

Post

mystran wrote:Ok, so I didn't want to pollute that other thread, so I'm starting a new one....

Code: Select all

  y[n+1] = s[n] + f*x[n]
  s[n+1] = s[n] + 2*f*x[n]

 where
  x[n], y[n] and s[n] are input, output and state

 and the tuning that maps the normalized analog frequency 1
 to whatever frequency we want is
  f = tan(M_PI * freq / samplerate)
If "n" is the last time step and "n+1" is the new one shouldn't this be:

Code: Select all

  y[n+1] = s[n] + f*x[n+1]
  s[n+1] = s[n] + 2*f*x[n+1]
which is equivalently:

Code: Select all

  y[n] = s[n-1] + f*x[n]
  s[n] = s[n-1] + 2*f*x[n]
?
The Glue, The Drop, The Scream - www.cytomic.com

Post

Long time since I looked into this thing, but since this thread pops up again, it reminds me of the following speculative intuitive observation that I made when reading the mystran's idea. I don't remember the details anymore, but IIRC my feeling was that mystran's approach should give you better results at not so extreme parameter values, whereas at the more extreme settings a "straighforward cheap" approach works better. I might be wrong here, just mentioning it FWIW. Maybe someone will be motivated enough to experimentally compare both :)

Post

Z1202 wrote:I don't remember the details anymore, but IIRC my feeling was that mystran's approach should give you better results at not so extreme parameter values, whereas at the more extreme settings a "straighforward cheap" approach works better.
What would be "straighforward cheap" approach? And what do you mean by "extreme parameter values", something like high resonance at high cutoff?
BTW, my hunch is that mystrans approach only fails somewhat at estimation when signal change is large from smaple to sample.

Post

urosh wrote:
Z1202 wrote:I don't remember the details anymore, but IIRC my feeling was that mystran's approach should give you better results at not so extreme parameter values, whereas at the more extreme settings a "straighforward cheap" approach works better.
What would be "straighforward cheap" approach? And what do you mean by "extreme parameter values", something like high resonance at high cutoff?
BTW, my hunch is that mystrans approach only fails somewhat at estimation when signal change is large from smaple to sample.
My point exactly (and this change would be large at extreme parameter settings). And "straightforward cheap" is to solve linearly and then apply the nonlinearity "on top".

Post Reply

Return to “DSP and Plugin Development”