Project

General

Profile

Compressor improvement

Added by Slawomir B over 5 years ago

Hello,

I have an idea for a significant improvement of audio quality generated by the current audio compressor. The current one is very prone to "ducking" when a considerable amount of bass kicks in. The loudness drops like crazy making the listening experience less than optimal. Which is a shame, because from what I can tell, the compressor has a lookahead built-in and acts rather nicely (apart from the example above).

Now, a professional solution to this problem, widely used for instance in a broadcast industry, is to introduce an additional element for driving the Compressor (strictly wideband compressor, AGC - Auto Gain Control), instead of using the actual audio feed for this. This crucial element here is Parametric Equalizer (PEQ).

The idea is to split the input signal into 2 chains:
- first one, being the actual compressor audio feed, which goes into compressor and is being processed
- and the other one, being PEQ sidechain which is used for driving the compressor. Typically, this PEQ features a considerable bass reduction and a slight dip in a midrange area.

So, the way it works is this: The compressor is receiving the flat and non-filtered audio, and acts upon it. However, the way it acts upon it is modulated via the PEQ sidechain (the filtered one).
This way, the impact of bass (and virtually any frequencies dialed-down by the PEQ) on the compressor, is mitigated. General listening experience - improved.

The block diagram of the circuitry looks like this:

The way, I'd set the sidechain is presented below (calibrated using pink noise and RTA)

The parameters

The one downside of this solution is that more peaks might be able to "slip" into the final mix, thus slightly reducing maximal loudness without distortion.
Let me know, what you think!

Cheers!
Slawomir


Replies (3)

RE: Compressor improvement - Added by John Lindgren over 5 years ago

The current algorithm to calculate peak "loudness" is indeed very crude (it is literally 5 lines of code - see calc_peak() in compressor.cc). If you can implement or recommend an alternative algorithm that has code available under a BSD-style license, I'd be happy to consider it.

RE: Compressor improvement - Added by Slawomir B over 5 years ago

You mean this?

/* I used to find the maximum sample and take that as the peak, but that doesn't * work well on badly clipped tracks. Now, I use the highly sophisticated * method of averaging the absolute value of the samples and multiplying by 6, a * number proved by experiment (on exactly three files) to best approximate the * actual peak. */

static float calc_peak (float * data, int length) {
float sum = 0;

float * end = data + length;
while (data < end)
sum = fabsf (* data +);
return aud::max (0.01f, sum / length * 6);
}

Will I literally have no idea how to code, but the key to success here is to disregard the bass parts in the calculation (say, below 150 Hz) This of course will leave more peaks on the table (from the bass itself), BUT the thing is humans don't perceive all frequencies as equally loud (especially bass). The current detector does.

RE: Compressor improvement - Added by Slawomir B over 5 years ago

Slawomir B wrote:

You mean this?

/* I used to find the maximum sample and take that as the peak, but that doesn't
  • work well on badly clipped tracks. Now, I use the highly sophisticated
  • method of averaging the absolute value of the samples and multiplying by 6, a
  • number proved by experiment (on exactly three files) to best approximate the
  • actual peak. */

static float calc_peak (float * data, int length) {
float sum = 0;

float * end = data + length;
while (data < end)
sum = fabsf (* data +);

return aud::max (0.01f, sum / length * 6);
}

Well I literally have no idea how to code, but the key to success here is to disregard the bass parts in the calculation (say, below 150 Hz) This of course will leave more peaks on the table (from the bass itself), BUT the thing is humans don't perceive all frequencies as equally loud (especially bass). The current detector does.

    (1-3/3)