Proofing that a compressor is a non-linear device

DSP, Plugin and Host development discussion.
RELATED
PRODUCTS

Post

Here it says a compressor is a non-linear device (and I think it's common accepted knowledge):

https://moinsound.wordpress.com/2015/01 ... -linearity

So I try to proof it:

Code: Select all

Linearity: a * f(x1 + x2) = f(a * x1) + f(a * x2)
=>
(1) Additivity: f(x1 + x2) = f(x1) + f(x2)
(2) Homogenity: a * f(x) = f(a * x)

Given: Say a compressor with ratio 4:1
=> Transfer function: y = f(x) = x/4

now assuming signal is above threshold:
(1) say x1 = 4; x2 = 8
f(x1 + x2) = f(12) = 12/4 = 3
f(x1) + f(x2) = f(4) + f(8) = 4/4 + 8/4 = 1+ 2 = 3
=> Additivity is true

(2) say a = 2; x = 4
a * f(x) = 2 * f(4) = 2 * 4/4 = 2
f(a * x) = f(2 * 4) = f(8) = 8/4 = 2
=> Homogenity is true
=> A compressor is a linear device
Huh ? Where is my mistake ?
(I know I'd actually have to use variables and not examples, but I feel I'm missing something fundamental here as these examples would work with all numbers I think)

Just in case:
This is NOT a homework assignment ! Just a lousy attempt to improve my rusty math skills.
Last edited by No_Use on Fri Jul 28, 2017 4:32 pm, edited 2 times in total.

Post

I think the answer is likely to be that it is only linear in the extreme: by the looks of it, you have assumed zero attack and infinite release.

In any real compressor, distortion depends on the current compression ratio, which is a function of the amplitude at prior points in time.

Post

No_Use wrote: Given: Say a compressor with ratio 4:1
=> Transfer function: y = f(x) = x/4
That's not a 4:1 compressor. That's a -12dB gain. :wink:

Post

And your mistale is obviously your assumption.
Of course, for course, for a signal above the threshold and provided you are using peak detection (no RMS), the compressor is linear.
The non linearity is that assumption, as it doesn't hold for signals lower than the threshold, and also with RMS.

Post

hugoderwolf wrote:
No_Use wrote: Given: Say a compressor with ratio 4:1
=> Transfer function: y = f(x) = x/4
That's not a 4:1 compressor. That's a -12dB gain. :wink:
Sorry, but I'm lost. :oops:
Could you elaborate ?

Post

x/4 is just a volume control set at -12 dB. Nothing nonlinear about that. That's not a compressor.

Describing a compressor in one equation isn't so easy (and probably not advisable anyway). You need to include the whole level following and time constant stuff. And of course the (nonlinear) gain curve.

The whole purpose of a compressor is to be nonlinear, so it doesn't really need proof. For a signal above threshold, if you put in 12 dB more at the input, the output a 4:1 compressor will only increase by 3dB. So homogenity is already violated.
Last edited by hugoderwolf on Fri Jul 28, 2017 4:51 pm, edited 1 time in total.

Post

oops

Post

No_Use wrote:Sorry, but I'm lost. :oops:
Could you elaborate ?
In your f(x), the x is the sample value, the "volume" of that signal at that given time.
If you lower the sample's value, then you make it quieter.
If you raise the sample's value, then you make it louder.

If you lower every sample's value by the same amount, then you have a linear change.
If you lower every sample's value by a different amount, based on the sample's value and/or other factors on the side (e.g. envelopes), then you have a non-linear change.

If you linearly halve every sample's value, then you are linearly halving its volume.
If you divide every sample's value by 4, then you are linearly halving its volume twice. (Because 2*1/2=1/4)

Your f(x) {y = x/4} does just that. It linearly lowers the sample value = volume of every input sample by the same amount.

As -6 dBfs are commonly considered "half volume", and your f(x) quarters (2*1/2=1/4) the volume, 2*-6 dBfs is -12 dBfs.

Ergo: your f(x) is just a -12 dBfs gain adjustment.
Confucamus.

Post

I get now where my mistake is, I proved that a fixed volume control is linear. :dog:

Thanks for the replies.

Post

Maybe a multiplication of two variables is a better approach to your proof. :)
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!

Post

Steps:
  1. Eliminate the envelope and any other filters
  2. Eliminate unneeded aspects such as ratio (assume ratio = 1/inf)
What do you have?

output = abs(input) > threshold ? input * (threshold / abs(input)) : input

This is trivial to prove nonlinear.

So all you need to do is come up with a model of a compressor based upon this and show how it is reduced to such a function.
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

The wrong asumption in in this example is that signal amplitude is constant.
If the amplitude is not constant, nonlinearity becomes obvious. And in the music it's never constant :P

Base signal with amplitude -15 dB (below threshold) will be uncompressed, while signal with 0 dB will be compressed.
Now add to it a noise with amplitude of -60 dB. The sum of -15 dB and -60 dB will still be uncompressed (below -12 dB), but 0 dB with -60 dB noise will become compressed more. End of proof.
Blog ------------- YouTube channel
Tricky-Loops wrote: (...)someone like Armin van Buuren who claims to make a track in half an hour and all his songs sound somewhat boring(...)

Post

This is how the proof should go:

First, define linear to mean that if the signal is X(t) after the process it's a*X(t).

Now define a compressor. For simplicity, just say that it's clipper function such that it's x, x < 32000 and 32000 , x>=32000.

Take 2 sample values, 35000 and 10 000, get out 32000 10 000. Clearly the condition does not hold, as 1*10 000 = 10 000 and 32000 * 1.09375 = 35 000.

But of course, if you only take one value, or inspect below the threshold, it's going to be linear.

EDIT: Or if you want to use the definition in the link:
First condition:
f(10 000+32000) != f(10 000)+f(32 000)
And the 2nd condition doesn't hold either:
1.09375*f(32 000) != f(32000 * 1.09375)

Post

No need to think about the threshold. Some compressor designs are threshold free anyway.

You can prove that generally, a multiplication of two variables is not linear. That's it.

The central aspect of a compressor is not the threshold, it's the modulation/multiplication.
Fabien from Tokyo Dawn Records

Check out my audio processors over at the Tokyo Dawn Labs!

Post

I only used the threshold for its very clear discontinuous action.

Yes many compressors instead use feedback or other non-linear scaling of the envelope to get a continuous curve rather than two linear segments with a discontinuity. I just thought the discontinuity was much easier to write a proof for as you could simply copy from the existing widely known proofs.

The other proof would also be the same proof as for ring modulation or a quadratic polynomial.
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”