MarcusAurelius wrote:So sorry to necro this thread after 3 years, but I didn't know where else to put this question.
I want to "upgrade" from the standard built-in Audacity compressor to this one but I am having trouble translating the settings.
Most compressors have a ratio of compression, like 1:2, 1:4, etc. This one however has a decimal. .8, .5. etc.
A straight mathematical translation doesn't seem to make sense to me, as I have seen recommendations for this plugin around .75-.8, but as a ratio that would be LESS than 1:2 (which would be .5) so I'm assuming the two methods can't be mathematically correlated.
I have seen success using about a 1:4 compression in my work. What would be the equivalent in this plugin?
Finally, a bit off topic, but I want to remove or reduce breathing noises but don't want something as clumsy as a noise gate. I currently have my noise floor in the regular Audacity compressor to -40. Would setting it to -35 or -30 (in either compressor) improve this without causing undue distortion? What would be the optimal settings for this in Chris' compressor?
An interesting problem, indeed.
You forgot to mention the normally used threshold, which doesn't seem to be used at all (for compression, not the noise floor).
At least, I can't make it out in the code.
The compression level is directly applied to the envelope values in dB.
This suggests an upwards compression.
Let's assume that we have two samples at different times -1.0 and 0.1.
They happen to be the peaks within the time frame (the length of the overlapping frames/windows is determined by the hardness, by the way).
To construct the envelope, we take the absolute values, i.e. 1.0 and 0.1.
We can now work with dB, instead of linear values (because we've eliminated negative values)
1 = 0 dB
0.1 = -20 dB
Our CL (compression level) is 0, the trivial case:
0 * 0 dB = 0
0 * -20 dB = 0
Those are the new compressed envelope points. we must translate them back to linear, which gives simply 1.0.
Before we multiply with the original sound, we must divide 1 by this value--gives still 1.0 in both cases.
Thus, the new samples are:
1.0 * -1.0 = -1.0
1.0 * 0.1 = 0.1
In summary, a level of 0 won't change our original sound.
Our next compression level is 0.5 and we multiply the previously found envelope values (dB) with this factor:
0.5 * 0 dB = 0 dB
0.5 * -20 dB = -10 dB.
Back to linear:
0 dB = 1.0 --> 1/1.0 = 1 (factor)
-10 dB = 0.3168 --> 1/0.3168 = 3.168
Those factors are going to be multiplied with the original samples:
1.0 * -1.0 = -1.0
3.1682 * 0.1 = 0.3168
You see, the lower sample value is now much higher and that's why I called it upwards-compression.
And what ratio does this translate to?
There you have me...
The missing threshold is a bit confusing, I have to admit.
Let's assume that it would be -40 dB.
Difference to 0 dB = 40 dB.
After the above calculation with the factor 0.5, the sample value would be at -20 dB and we amplify by this amount to get back to the original -40 dB, i.e. the sample value would still be 0.01.
However, the value of 1.0 (0 dB) would newly be 0.1 or -20 dB.
The new difference is therefore -20 dB - -40 dB = 20 dB.
Thus, the ratio is 40 dB : 20 dB or more common 2:1.
Let's do it with the factor 1.0:
The initial difference is the same 40 dB.
All envelope points are essentially amplified by their (positive) value in dB. -20 by 20, -40 by 40 and so on.
This implies a ratio of infinity:1--as used by a hard limiter.
However, this is a bit queer since the plug-in allows values of 1.25 as compression level.
Very strange? Yes, it is because it inverts the loudness values somewhat. Low peaks (above the noise floor) will be louder than those that were previously already at full scale!!!
I will now make a guess in the wild as how ratio translates to the compression level.
- 1:1 = 0.0 compression level
- 1:infinity = 1.0 compression level
possible formula: 1 - (inverse ratio)
ratio 1:1 --> 1 - (1/1) = 0.0
ratio infinity:1 --> 1 - (1/infinity [approx 0]) = 1.0
ratio 2:1 --> 1 - (1/2) = 0.5
ratio 4:1 --> 1 - (1/4) = 0.75
ratio 10 :1 --> 1 - (1/10) = 0.9
ratio 1:2 (expansion) --> 1 - (2/1) = -0.5
ratio 4:-1 (inverse loudness) --> 1 - (-1/4) = 1.25
Does this make sense?