The good ol' unit delay ladder filter problem

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Hey all.. this topic has probably been done a bit here, but I couldn't find exactly the info I'm looking for regarding the unit delay in a moog-alike ladder filter. I'm trying to figure out if my understanding of the unit delay problem is accurate.

To my knowledge, the problem is that the extra sample of delay in the feedback is adding 1/sRate seconds to the wavelength that is supposed to be emphasized. This would cause the resonance to be knocked off by a little, causing the wrong frequency to resonate (where originally it's supposed to be a full cycle: -180 degrees at cutoff coming out of the 4 1-pole lp series, then inverted so that the phase is 0 or 360).

So, if you were at 100hz, that's a 441 sample wavelength at 44100hz. But if you add that extra sample of delay in, now you're at 442 samples. Feeding this back into the original signal will now emphasize 99.78hz and not 100hz.

Or at least that's how I understood the problem. I read something recently which claimed that it was more of a gain problem-- that at low frequencies, the gain would be too low and that it can be corrected for by using a table. Is this maybe because the frequency difference I mentioned above isn't large enough to be audible as "the wrong resonance frequency" as much as partially canceling the sinusoid it's supposed to be reinforcing?

So, am I way off? And, supposing I'm not, couldn't the issue be corrected for by, instead of inverting the phase in the feedback loop, adding more delay and/or an allpass filter to make the signal lag by a full cycle at cutoff before adding it back in? Finally, wouldn't the problem be much worse at high frequency cutoff values and not at low ones?

Hopefully this post made some sense :)

Cheers,
Louis
OPL2 is forever

Post

Ok, the unit delay adds

2*PI*f/fs

delay to the signal. That means at the amount of phase delay it adds depends on what frequency you're interested in. So at 5k, with 44.1k sample rate it'll be...

2*PI*5000/44100 = 0.226*PI

Each pole of the moog filter, a one pole lowpass, has a phase that varies between 0*PI and PI/2, with it hitting PI/4 at the cutoff, the 3db point.

You put 4 in series you get accumulated phase shift of PI at the cuttof, which is 180 degrees out of phase with the input. So if you negate that signal and feed it back the frequencys at the cutoff will be in phase with the input and cause them to be emphasised.

The problem is the extra phase shift from the 1 sample delay means the point where the exact 180 degree phase shift happens is moved. If you set the filter cuttof to 5k, it'll happen at the point where the filter+unitdelay phase shift combines to an overall 180 degrees. Or put another way where

filter_phase_at_f = PI - 2*PI*f/fs

The gain problem is that because the 180 degree point is shifted away from the 3db point, it means that the resonance level will change. Because the signal you feedback is not just phase shifted, it also lowpassed, so if it stayed at the 3db point, then the gain at the cutoff would 4*3db. If the unit delay shifts the cutoff up a bit to the 2db point, then now the gain of the signal at the cutoff is 4*2db.

So the feedback gain required to keep the resonant peak at a constant level depends on cutoff freqeucny. So the feedback gain that gave you a nice 30db resonant peak somewhere else, will now caus the filter to explode.

That's what causes filters to explode or lose resonance and such like.

The problem with adding an allpass to correct the phase is that it'll create more than one point where the the feedback signal is in phase. If you add an allpass filter and use positive feedback you'll end with it inphase at DC, so you'll get a peak at DC aswell. Which will explode before the peak at the cutoff can even get going.

The point is, it has to be out of phase at DC, and in phase at the cutoff, above the cutoff doesnt matter as the signal is so attenuated by the lowpass poles it has virtual no effect.

Yes the problem gets worse as you get closer to nyquist.

Post

been there, done that. ...and wrote a little paper about it:

http://www.rs-met.com/documents/notes/R ... Filter.pdf
My website: rs-met.com, My presences on: YouTube, GitHub, Facebook

Post

nollock wrote: The gain problem is that because the 180 degree point is shifted away from the 3db point, it means that the resonance level will change. Because the signal you feedback is not just phase shifted, it also lowpassed, so if it stayed at the 3db point, then the gain at the cutoff would 4*3db. If the unit delay shifts the cutoff up a bit to the 2db point, then now the gain of the signal at the cutoff is 4*2db.
When the cutoff frequency is raised and the resonant peak moves futher away from the cutoff frequency, does the resonant peak move higher in frequency or lower with respect to the cutoff frequency?

My intuition says it moves higher, but I'm not sure that's right. If it moves lower in frequency, then the frequencies it's emphasizing have a higher gain than the higher frequencies, which makes the explosion more understandable.

Post

Robin from www.rs-met.com wrote:been there, done that. ...and wrote a little paper about it:
No t-shirts ? :)

Post

Leslie Sanford wrote:When the cutoff frequency is raised and the resonant peak moves futher away from the cutoff frequency, does the resonant peak move higher in frequency or lower with respect to the cutoff frequency?
IIRC the 180 point moves to a lower frequency. As the unit delay adds more phase shift the 180 point will move lower in frequency to where the lowpass poles have less phase shift.

Post

Robin from www.rs-met.com wrote:been there, done that. ...and wrote a little paper about it:

http://www.rs-met.com/documents/notes/R ... Filter.pdf
Yeah that pretty much covers it all. :)

Post

nollock wrote: IIRC the 180 point moves to a lower frequency. As the unit delay adds more phase shift the 180 point will move lower in frequency to where the lowpass poles have less phase shift.
That makes sense.

I wonder if it would be a viable approach to use one of the earlier filters as the feedback source to offset the difference in phase, say work out an algorithm where you crossfade between the fourth and third filter output to use as feedback as you increase the cutoff frequency.

Post

Leslie Sanford wrote:
nollock wrote: IIRC the 180 point moves to a lower frequency. As the unit delay adds more phase shift the 180 point will move lower in frequency to where the lowpass poles have less phase shift.
That makes sense.

I wonder if it would be a viable approach to use one of the earlier filters as the feedback source to offset the difference in phase, say work out an algorithm where you crossfade between the fourth and third filter output to use as feedback as you increase the cutoff frequency.
feedback from the third and fourth pole?
this still smells like 1 sample delay to me..
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

Yes, its still one sample delay. I think the point is just to compensate for the phase offset that this delay introduces. I've no idea if this would be possible though, but it'd play around with the frequency response a bit.

Post

well, to compensate, one way is to just increase the feedback level additionaly, depending on the cutoff frequency
tho, by increasing the feedback - the resonant frequency "moves" away too in some filters iirc
this is what Robin's paper explains for the moog filter
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

I must not understand the problem.

There are four sample delays in the digital ladder filter. The output of the fourth delay is 180 degrees out of phase with the input. Inverting the fourth delay and feeding it back into the input emphasizes (ideally) the cutoff frequency creating a bump in the frequency domain around the cutoff frequency. Voila! Resonance.

But as the cutoff frequency is increased, the four sample delay causes the feedback to emphasize frequencies that are increasingly lower than the cutoff frequency. Since these frequencies have a higher gain than the -3dB cutoff frequency, the filter eventually explodes.

Is this a correct and accurate statement of the problem?

If so, can we compensate for the feedback offset by shortening the feedback delay? Say by increasingly crossfading the output of the third filter with that of the fourth filter?

EDIT: Just for clarification, I'm not suggesting that this strategy will cure the problem; I'm just wondering if it will help aleviate it a bit.

Does that make any sense?

Also, as far as compensating by increasing the feedback value as the cutoff frequency increases, doesn't that make it more likely that the filter will explode sooner?

Post

Leslie Sanford wrote:I must not understand the problem.

There are four sample delays in the digital ladder filter. The output of the fourth delay is 180 degrees out of phase with the input. Inverting the fourth delay and feeding it back into the input emphasizes (ideally) the cutoff frequency creating a bump in the frequency domain around the cutoff frequency. Voila! Resonance.

But as the cutoff frequency is increased, the four sample delay causes the feedback to emphasize frequencies that are increasingly lower than the cutoff frequency. Since these frequencies have a higher gain than the -3dB cutoff frequency, the filter eventually explodes.

Is this a correct and accurate statement of the problem?

If so, can we compensate for the feedback offset by shortening the feedback delay? Say by increasingly crossfading the output of the third filter with that of the fourth filter?

EDIT: Just for clarification, I'm not suggesting that this strategy will cure the problem; I'm just wondering if it will help aleviate it a bit.

Does that make any sense?

Also, as far as compensating by increasing the feedback value as the cutoff frequency increases, doesn't that make it more likely that the filter will explode sooner?
nope, there are 4 1-pole filter stages in the ladder, but not 4 samples delay
imagine you probe the ladder with an impulse
ladder is processed: first stage (it's just a simple 1 pole LP filter)
it recieves an input of 1.0 and previous outputs are 0.0.. it immediately reacts to this 1.0 impulse depending on it's coefficients, but erm, it outputs a NON-zero sample
^^^ there was no delay so far
move on to next filter stage oh wait, it recieves the output of the previous stage, which is NON-zero so again, we'll have a non-zero output from the second stage too
same happens as we move forward
all stages will react to this impulse immediately, so there is no 4 samples delay

there IS a delay when you feedback the 4th stage output to the 1st stage input, a delay of 1 sample that we're talking about here..
It doesn't matter how it sounds..
..as long as it has BASS and it's LOUD!

irc.libera.chat >>> #kvr

Post

antto wrote: there IS a delay when you feedback the 4th stage output to the 1st stage input, a delay of 1 sample that we're talking about here..
Ah! I understand now. Thanks for the explaination. I appreciate it. :)

Post

Just a round-up of methods for fixing:

1. solve by iteration, works fine, but could just as well oversample

2. solve analytically, doesn't work nicely with embedded non-linearities

2. add an extra zero at -1 into the feedback path (from original paper by A.Huovilainen), works reasonably with oversampling

3. add zeros to the lowpass stages to compensate, either static (the famous Stilson paper) or dynamic (Stilson's thesis has a 1st order fit that works wonders)

4. tune for the 180 with-delay point and solve the required feedback (Robin's paper got math)

Any others?

Post Reply

Return to “DSP and Plugin Development”