Cabbage Logo
Back to Cabbage Site

Automatic Gain Compensation

Hi everyone,

does anyone ever implemented an automatic gain compensation?

Lets assume you boost 12 db with an EQ you will compensate that level boost, but automatically, to make a realistic comparision between the boosted and the non-boosted version of your signal.

I tried something with the RMS opcode but was not quite succesful. Balance opcode does not help either.


I usually use a balance opcode with filters. Many filters also have a scaling parameter. If you prepare a simple example illustrating the problem we might be able to find a solution.

I came across this issue these past few days.

Here is an example of a transient detection algorithm (in its early state, I had to re-code it from scratch because of overfitting…):

The envelope is too slow. So let’s use the balance2 opcode to boost it.

It works well but it ruins the dynamic. I think it’s intentional so take care when you use this opcode, especially after effects that shape the dynamics!

A simple alternative is to compute the rms of the two signals, compute the ratio and multiply the signal you want to boost by this ratio. You get:

I’m still not sure how to interpret it but it’s better for my needs. It preserves most of the dynamics but it attenuates the signal right when I need it (it’s almost magical). I will dig more and find out what’s happening!

1 Like