How does a dynamic eq work?

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

Post

I'm starting to think the problem is somehow related to doing two or more allpasses in series or Max's equation (when used in series).

Or then DSPFilters' RBJ::AllPass is broken somehow.

Using the same library's (DSPFilters) RBJ::BandShelf filter to drive the gain and I can easily do two or more such equalizations in series. This doesn't require Max's equation.

Post

One possibilility, perhaps a long shot-- Not specific suggestion, just something to keep an eye on--

The other day was experimenting with networks of first-order allpass for envelope smoothing. Two paths of series allpass, added together. Same approach as using two chains of allpass for "fake hilbert" quadrature generators, except I only needed to smooth a couple or three octaves in the low bass. A limited-frequency-range fake hilbert.

So anyway, you can make two versions of an allpass. Really, the only difference is that one allpass is the inversion of the other allpass. Just multiply by -1.0 to switch between the versions

So anyway, a single instance of the first order allpass, one version is +180 degrees phase shifted approaching DC, and 0 degrees phase shifted approaching nyquist.

The other version is 0 degrees phase shifted approaching DC, and -180 degrees phase shifted approaching nyquist.

Both versions have exactly the same shape and span. Just one of them starts from the bass at +180 degrees, and the other version starts from the bass at 0 degrees. Identical curve shapes, offset 180 degrees from each other.

So anyway, because I was operating on envelope code, after the AC signal has been turned into a DC envelope-- I was using the "high pass" variant of the allpass, and noticed when debugging that one allpass was flipping the entire envelope negative, then of course the next series allpass was flipping the entire envelope positive again. The smoothed envelope is a lot closer to a DC signal than an AC signal. A DC signal with some ripple riding on it I wanted to better-suppress.

So an odd number of series "highpass" allpasses would end up with an inverted output signal at lower frequencies, even if the allpass FC is tuned to the mids or highs. But the higher frequencies would not get inverted, just shifted.

An odd number of series "lowpass" allpasses would end up with an inverted output signal in the highs, but not inverted toward the bass.

I think even numbers of series allpasses, of either kind, with several in series, some frequency ranges would get inverted just because of extreme phase shift, but I don't think even numbers of series allpass would "catch one by surprise" with phase flipping one didn't expect.

Your report of sections getting "inverted in gain" sounds similar enough to that behavior, maybe it has something to do with phase-flipping?

Post

I think the RBJ second order allpass is 0 degrees at Fc, and goes positive below Fc, and goes phase negative above Fc. So maybe you could still get surprised with extremes getting "phase flipped" as you didn't expect, but maybe not as dramatic of a surprie, because the center frequency doesn't get phase shifted.

Post

JCJR wrote:Just multiply by -1.0 to switch between
Yep. The one that starts at +180° has just wrong "polarity".
Fluky wrote:I'm starting to think the problem is somehow related to doing two or more allpasses in series or Max's equation (when used in series).
I looked at the code in viewtopic.php?f=33&t=443112&start=60#p6456176 and sure you just cascade them improperly. To get two band-shelf filters in series you cascade the band-shelve filters in series. Thus if a single second-order band-shelf section is implemented as a mix of the input and an allpass filter, a next cascaded section is to use the input from the previous section and not the initial input. In your code you actually cascade only allpass filters, thus getting a fourth-order allpass, and then mix its output with the initial input - which obviously can't give you a band-shelf.

Maybe this simple pseudo formulae could help you, consider:
F = X + A;
where X is the input, A is allpass filter and F is the resulting filter.
Two such filters:
F1 = X1 + A1
F2 = X2 + A2
in series:
F1 * F2
would be:
(X1 + A1) * (X2 + A2)
and not:
X1 + A1 * A2
like you wrote in your code.
Last edited by Max M. on Thu May 05, 2016 8:35 pm, edited 1 time in total.

Post

That pseudocode doesn't help me implement it, because I don't see the connection to my code.

E.g. how to implement (X1 + A1) * (X2 + A2) * ... in my code. And why there's a multiplication. Isn't that amplitude modulation?
Last edited by soundmodel on Thu May 05, 2016 9:04 pm, edited 1 time in total.

Post

Message removed.

Post

Mmm, you're right. It's maybe the naming convention (s? f?) that confused me at first. Now I see you code does not show the cascading itself. So the code for each section seems to be correct, now make sure that each section output does not point to the same buffer (it's still looks like there the filter of the second section overwrites that section's own input buffer (which is supposed to already contain the output of the first section, is it?) when you store your temporary allpass output there). Sorry, it's a bit complicated to debug w/o seeing the whole picture since there you have a bit cluttered combo of per-frame-based and per-sample-based processing (so it's hard to be sure what is the actual value of each in[*]/out[*] thing at every given statement there).
Last edited by Max M. on Thu May 05, 2016 9:22 pm, edited 1 time in total.

Post

It's enough if we can clear it in pseudocode.

How do you implement * in (X1 + A1) * (X2 + A2) * ...? It cannot be multiplication?

My code is supposed to do:

Let I1 be initial input, A() the allpass filter operation:

S1 = I1 + A(I1)
S2 = I1 + A(S1)
S3 = I1 + A(S2)
...

I.e. the next allpass filter is applied to the (entire, summed) output of the last section. And summed again to the input.

Post

Fluky wrote:How do you implement * in (X1 + A1) * (X2 + A2) * ...? It cannot be multiplication?
You don't need to implement this directly, it's just to illustrate that the input of the second section should be the output of the first. I know it's obvious, but it's not evident if your code does this. I.e. are in[*] values of your second section point to out[*] values of your first section?

---

P.S. The multiplication in (X1 + A1) * (X2 + A2) actually has pretty strict physical meaning (if we take each X and A as transfer functions) but I don't want to confuse you more since that would be sort of irrelevant to the problem (X and A are not individual samples you need to multiply).

Post

Fluky wrote:My code is supposed to do:
Let I1 be initial input, A() the allpass filter operation:
S1 = I1 + A(I1)
S2 = I1 + A(S1)
S3 = I1 + A(S2)
...
Yep, that's what I mean (sorry I'm really bad in explaining these things of simple sentences :phones: ).
This is not correct cascading, the correct one should be:
S1 = I1 + A(I1)
S2 = S1 + A(S1)
S3 = S2 + A(S2)
etc.

Post

Max M. wrote: Yep, that's what I mean (sorry I'm really bad in explaining these things of simple sentences :phones: ).
This is not correct cascading, the correct one should be:
S1 = I1 + A(I1)
S2 = S1 + A(S1)
S3 = S2 + A(S2)
etc.
This seems to work!

Thank you for your help.

Post

Okay so the allpass filter method has been covered here and it's a fairly simple way to do dynamic equalization because one can apply the gain reduction to the allpassed signal and not have to deal with making the filter design follow some gain changes.

However, is it possible to do dynamic equalization using filter algorithms directly? I.e. make some filter behave like a dynamic one by recomputing coefficients according to gain changes?

Particularly I'm interested whether something like Parks-Mccellan could be adopted to dynamic equalization?

Post

Also can the allpass approach be used to realize other filter shapes than cutting peak? Such as shelves?

Post

Fluky wrote:Also can the allpass approach be used to realize other filter shapes than cutting peak? Such as shelves?
Of course you can, just add the original signal to a fraction of the allpass, and you end up with a shelf ;)

Post

All the different "types" of filter are the same thing.

An integrator arranged in different ways.
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 Reply

Return to “DSP and Plugin Development”