How does a dynamic eq work?

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

Post

How does a dynamic eq work? What's the signal chain?

Specifically how is it possible to apply the gain reduction only to particular frequencies without noticeably filtering other frequencies? Or is the envelope follower controlling a gain of a filter?

Does using filterbanks not create losses in the audio signal? So for desktop (not live) use this wouldn't even be practical since it filters the sound too much, unless it's used only for analysis purposes?

What about using FFT vs using filterbanks?

Post

Maybe someone will tell us the efficient way to do it.

FFT with acceptable quick envelope time performance might be expensive. A way to get good frequency discrimination and also good time resolution I have read about-- No practical experience-- Something like put small segments of audio in big buffers otherwise full of zero samples. Do a big fft on the tiny slice of audio. And overlap those tiny pieces for good modulation time performance. So you do lots of big ffts and iffts in order to gain sufficient time resolution to smoothly modulate the timbre.

If you take a simple iir bandpass filter. Not a parallel bank of them. Just one bandpass at a time. Run the blocks in series for several bands without nasty inter-band phase cancellations. This could be fairly cpu efficient.

If you add this bandpass to the original signal you get gain. The bandpass typically has zero phase shift at the center frequency, and then phase shift at the skirts. Assuming the bp filter has unity gain at center freq, for instance you get 12 dB boost with (BandpassInput + 3 * BandpassOutput). Conversely you get -12 dB cut with (BandpassInput - 0.75 * BandpassOutput).

A problem with that however-- If you keep the filter constant-- If you don't modify the center frequency or Q over time-- As you make the cut deeper, the valley gets narrower in frequency. A 6 dB cut has a narrower valley than a 3 dB cut, etc. As you make the boost bigger, the hill gets wider.

That would seem less than desirable for dynamic EQ. Preferable would be so-called constant-Q behavior where a 6 dB boost is the mirror image shape of a 6 dB cut, etc. When viewed on a log-log graph.

To get constant-Q behavior, for every change in gain, you have to recalculate the filter Q. Make the Q ever smaller with bigger cuts, and make the Q ever bigger with bigger boost.

So then if you need to recalc the filter dang near every sample, one might as well ditch the bandpass and adopt something like rbj's well behaved peaking filter which automatically adjusts the Q according to gain to make it work right. Might need to take care to somewhat limit the slew rate of the gain modulation, to prevent the filter going unstable over fast gain changes?

Maybe after the user sets an EQ freq and width, the program could do a fast loop and calculate a big table of filter coefficients. I dunno, maybe a different set of coeffs for every 0.1 dB gain change or whatever works? Then rather than recalc from scratch every sample, you could linear interpolate between coefficient table entries every sample? Maybe that would be a little faster, dunno. Maybe it wouldn't sound awful. Or maybe it would.

Perhaps FIR linear phase filters would be better behaved in this use? Dunno. That would be expensive as well.

On the other hand multiband compressor/expander would seem less expensive in cpu cycles. There are possible not incredibly expensive ways of splitting into multiple bands that can add back together flat without phase cancellation at band boundaries. Expensive, but not incredibly expensive.

So now maybe someone will volunteer the cheap practical way of doing dynamic EQ. :)

Post

Was thinking of merely doing an envelope follower (e.g. Hilbert envelope) that follows the peaks above some threshold. Then applying that envelope negatively to a filter gain parameter (so that it's modulated).

It seems simple, but I'm wondering whether it's missing something.

Post

Yeah that is the general idea. Just how to do it efficiently. And have it useful and good sounding when complete.

Some designs with IIR filters could use a single filter for both envelope detection and also audio processing. Other possible designs would need two filters for each band, one filter for the envelope detector and another filter for the audio processing.

Post

Any ideas regarding the envelope follower? If it's the same type as in compressors? Some say the Hilbert envelope might not to work very well since the signal would need to be "narrow-band".

Post

Hilbert is sometimes done with two parallel chains of allpass filters, such that over a fairly wide frequency range the outputs of the two chains are about 90 degrees apart. But both of the phase shifter chains are phase shifted a little behind the original signal.

Such a hilbert might have at least a little bit of delay, relative to the original signal. Possibly the processed signal would need a bit of compensating delay so that it might better line up with the timing of the hilbert-- So that the envelope doesn't lag the signal it is trying to control?

I've meant to play with a hilbert envelope detector sometime, but never did. I've mainly used smoothed peak envelopes, and some 300 ms RMS envelopes. But mainly smoothed peak envelopes. If a peak sensing smoothed envelope has a fairly fast attack and fairly long release, it tends to track near the peak values in the signal. With slower attack, the peak sensing envelope design tends to track closer to the average signal level.

Average and rms are similar measurements and sometimes they can be roughly equivalent in the real world. However, rms is maybe "more precise" for certain uses. For instance, if you go shopping for a good electronics bench multimeter, you can expect to pay more for a nice rms meter, compared to the price of a nice enough averaging meter.

Just in my experience I got more use out of peak envelope with adjustable attack and release. Because it is a big sin to clip the audio. I never got much satisfaction using the rms button on compressors. Some folk use RMS sensing a bunch, but such slow compression never seemed very useful to me. It is just a matter of opinion and personal taste.

Post

Know any source codes for a peak follower?

Post

For a peak follower, just do the abs value and then an attack/release filter after: https://github.com/mbrucher/AudioTK/blo ... er.cpp#L65

Post

For doing the gain reduction I recognize two approaches. One is to modulate a gain parameter of a filter and the other would be to bandpass the input signal using zero-phase bandpass (which I cannot seem to find though) and then feed that back into the input signal (the amount fed corresponds to gain and inverting the phase of this would create "cuts"). Are there any other ways?

Post

You can use an all-pass filter with the proper phase difference (0 or 2pi outside the required bandwidth, pi inside). May be possible to do so by cascading two all-pass filters. Or not. Haven't tried that one.

Post

It works, I designed such a filter in 2003. Unfortunately the phase response of the total system is quite different than most other filter implementations. By the time you have several stages in series the total response looks quite chaotic.

I gave up on the idea for two reasons:
1) Too expensive (2003)
2) Phase shifts are unacceptable
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

Miles1981 wrote:You can use an all-pass filter with the proper phase difference (0 or 2pi outside the required bandwidth, pi inside). May be possible to do so by cascading two all-pass filters. Or not. Haven't tried that one.
I can't find that kind of all-pass filter. I find all-pass filters that have the following phase curve: http://audioxpress.com/assets/upload/im ... igure2.jpg. But not something that would have the same signed phase around the cutoff freq.

Post

So the gain-controlled bandshelf is a better option (e.g. using KHN state variable impelementation, as mentioned in another thread)? Wonder if it's the only option then, aside zero-delay bandpass mixing, which though is the same?

Post

It certainly isn't the only option although it is likely the easiest for you to implement on your own.

Try using a single allpass filter with negative feedback.

Code: Select all

float allpass(const float in, float &b, const float c)
{
 const float x = (in - b) * c;
 const float out = b + x;
 b = in + x;
 return out;
}


coefficient = tan(2 * pi * hz / sr)
feedback = -not_sure(bandwidth)
out = allpass(in + out * feedback, buffer, coefficient);
Then convert this into "zero delay feedback" by approximating the state change due to the input without feedback and using that as an approximation of the feedback signal. You can get better results using an iterative solution where the first approximation is an underestimate (due to missing the feedback contribution) although if I remember correctly it should work okay as-is.
Last edited by aciddose on Wed Jul 29, 2015 12:15 pm, edited 1 time in total.
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

Fluky wrote:One is to modulate a gain parameter of a filter and the other would be to bandpass the input signal using zero-phase bandpass...
It's usually done with ordinal 2nd-order allpass mixed with the input (yes, the result of such mix is a classical bell-shaped peaking curve). Note however that you still need to cascade such EQ sections, otherwise (if you put such "bands" in parallel) you'll get a screwed frequency response because of different phase shifts in overlapping areas. There're some papers on making a multiband EQs with all-parallel stuff, but arithmetics there is probably too complex for real-time modulation (you never now until you try though)).

Post Reply

Return to “DSP and Plugin Development”