Resonant one-pole LP?

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

Post

I haven't found any example code for one, but I see it all the time in FL Studio.

Post

Not sure how it's done there, but you'd typically process a 4-pole ladder with resonance and connect the output with the first stage rather than the 4th - thus you get a 6dB lowpass. The feedback still comes from the 4th stage, providing for steeper passband (even self oscillation maybe)

Post

That's how we do it too. There may be other ways, however (the most obvious using a 2-pole design and taking the first output).

Richard
Synapse Audio Software - www.synapse-audio.com

Post

Thanks Richard, it works :D
Seems to have some quirks but it does what it's supposed to.

Post

camsr wrote:I haven't found any example code for one, but I see it all the time in FL Studio.
It's important to realize that it's impossible to have resonance in a pure one-pole filter: you need at least two poles, so you can have your complex conjugate pole-pair.

So.. any "one pole" with a resonance is necessarily a higher-order filter where some of the zeroes are simply configured such that the resulting low-pass response is only 6dB/octave.

Anyway, ladders work well if you don't mind 4 poles internally. Beyond ladder designs, I guess you could also mix input after the first pole in a "Sallen-Key" OTA design. Those often have 6dB/octave highpass by feeding the highpass input into the second cap, the same idea should work with low-pass too.

Post

If you don't want to use a full ladder you could also use a regular SV filter ~LP6dB = (LP+BP) * (sqrt(0.5)).

Andrew

Post

Ichad.c wrote:If you don't want to use a full ladder you could also use a regular SV filter ~LP6dB = (LP+BP) * (sqrt(0.5)).

Andrew
Oh yeah, that works too.

Post

In case anyone cares, I am trying to adapt neotec's approach to ZDF.
http://www.kvraudio.com/forum/viewtopic.php?p=5470738
But some things about the feedback structure are unclear to me.
I setup two LPs with the right flow, but the resonance does not tune correctly, it shifts up with increased feedback.
There is a unit delay between the two filters in the feedback loop.

Code: Select all

void filter (float* it, float* up)
{
    static float buf1;
    static float buf2;
    static float sumin;
    static float out;
    float f = 0.001f;
    float k = -1.f;
    float f2 = 1.f / (1.f + f);

    //LPF 1
    out = (f *  (sumin + (*it)) + buf1) * f2;
    buf1 =  f * ((sumin + (*it)) - out) + (out);

    // output between LPF1 and LPF2
    (*up) = out;
    // scale FB 
    out = out * k;

    //LPF 2 addend for LPF1 input
    sumin = (f *  (out) + buf2) * f2;
    buf2 =  f * ((out) - (sumin)) + (sumin);


}

Post

camsr wrote:There is a unit delay between the two filters in the feedback loop.
That's not ZDF then. In order to tune it correctly, you have to solve this:

y1 = filter1( in + res * y2 );
y2 = filter2( y1 );

which gives you a bit of a problem, because

y2 = filter2( filter1( in + res * y2 ) );

Without unit delay you have y2 on both sides of the equation, and buried deeply into the filters. But don't worry… it can be solved:

Using a state variable for the capacitor charge and solving the lowpass like Andy does, you get

feedback = y2,
y1 = ( g * ( in - r * feedback ) + s1 ) / (1 + g ),
y2 = ( g * y1 + s2 ) / ( 1 + g )

using Maxima, this yields:

feedback=(g*s1+g^2*in+g*s2+s2)/(g^2*r+g^2+2*g+1)

This is your feedback. Now you can calculate y1 and y2.

Then update s1 and s2 with trapezoidal integration like this:

s1 = 2 * y1 - s1;
s2 = 2 * y2 - s2;

There you go. No unit delay :-)

(haven't tested yet)

Post

Or you can do it with matrices. See the thread "zero delay the easy way."

Post

Thank you Urs, I attempted to solve it myself and ran into problems. I also can't use Maxima on my computer for some reason, so I have to figure out that problem also.

Post

Urs, how did you arrive at that answer? I put it into maxima but I get a slight variation. I think my syntax is wrong. Any help appreciated.

Post

I have wondered if first order resonance could be "sneaked up on" via first order allpass filter with feedback? Not necessarily as something which would be better fit-for-purpose than some other solution, merely as a puzzle whether it could be done.

For simplicity sake, consider a simple one-capacitor, one-opamp, three resistor analog phase shifter. A stack of those, mixed with the input signal and with global feedback, will have increased resonance, steeper walls of the frequency notches or humps (depending whether the allpass stack is added to or subtracted from the input signal).

Rather than a chain of allpass as in a phase shifter effect-- Consider a single unity-gain-at-DC allpass, with its output added to the input signal, would be a first order lowpass with gain of 2 at DC if recalling correctly. The gain would fall to 1.414 at Fc and trend toward zero gain going higher in freq. The phase of the allpass would be -90 degrees at Fc, and the Fc phase of the added together lowpass would be -45 as with a first order RC analog filter.

If modest positive feedback were applied from the mixed lowpass output to the allpass input, it seems that passband gain ought to rise faster than stopband gain? In addition, mixing in the phase-shifted lowpass feedback would nudge the phase shift of both the allpass output and resultant mixed lowpass a little further backwards with each iteration of the feedback? And each incremental phase shift increase in the feedback ought to further enhance the phase cancellation at Fc and above?

OTOH, it seems that negative feedback from mixed lowpass output to allpass input, ought to reduce low freq gain in the mixed lowpass output and possibly raise or at least maintain gain in the vicinity of Fc, without significantly affecting gain in high frequencies (because there is not as much signal level in the high freq negative feedback to affect the output very much)? A kind of peaked lowpass or bandpass curve?

Its been so long since studying such things, maybe I'm not imagining the result properly. It just seems to offer possibly "more interesting" transfer functions than one would typically expect from a first order filter? Or not. Maybe I'm imagining it all wrong.

Post

camsr wrote:Urs, how did you arrive at that answer? I put it into maxima but I get a slight variation. I think my syntax is wrong. Any help appreciated.
Sorry, I hadn't seen this post last week…

In Maxima I usually solve for all Ys to make this work. Dunno why it doesn't do things for just one variable.

I think we'll soon post a set of papers that has examples specifically for Maxima.

Post Reply

Return to “DSP and Plugin Development”