Compressor

From Audacity Development Manual
Revision as of 05:17, 19 November 2009 by Billw58 (talk | contribs) (amend comments in light of further tests)
Jump to: navigation, search

Flag_of_Holland_small.png

Bill: Note to self for post 2.0. Virtually all real-world compressors use the word "Release", not "Decay". The graphic example uses "Release".

This page need a major make-over. The Compressor plugin now has another slider - Noise Floor - that needs to be documented. 'Normalize to 0 dB after compressing' now reads 'Make-up gain for 0 dB after compressing'. There is a checkbox for 'Compress based on peaks'. The blue line in the graph is now pinned to the upper-right instead of the lower-left. This is confusing for audio engineers as they're used to seeing compressor graphs with the curve pinned to the lower-left. The old graph was better in that regard. The new graph display is, I suppose, appropriate when the 'Make-up gain' option is chosen. It would be nice if the graph would change where it's pinned based on that option.

  • Gale: I will raise this on -devel list - I don't recall any reason for the pinning axis changing, but I will ask. I agree Cool Edit Pro pins as you suggest.


All that aside, I guess we need to document what the Compressor currently does and how it behaves. I may have a go at describing how the graph works and what it means, after I un-learn 35 years of using compressors.
Does anybody know what the 'Noise Floor' slider does? - Bill W

  • Gale: I had asked the contributor who made these changes to document them. I have some very basic information I can add based on the -devel list discussions. I think it's better I do that and you ask questions after that if you have suggestions for improvement.

Bill: I've gone ahead and documented this, as it seems unlikely to be fixed in time for 2.0.

Compressor reduces the volume of louder sounds while leaving quieter ones untouched,
Steve the Fiddle Only in the case of downward compression. When "Compress based on peaks" is selected, this is an "upward" compressor - it keeps audio with high peak amplitude at the same level and raises the level of audio that has a peak amplitude below the Threshold.

Audio with a peak level below the "Noise Floor" is not changed.
Essentially, when "Compress based on peaks" is selected, there is dynamic expansion between the Noise Floor and Threshold, and dynamic compression above the Threshold.
Bill: Your third statement is correct, but it conflicts with your first statement. There is always downward compression above the threshold. How the code handles this I can't tell, but I've done a series of tests with chirps that clearly show that downward compression (according to the ratio) happens above the threshold when "compress based on peaks" is checked. You are correct about the "upward expansion" between the threshold and the noise floor when "compress based on peaks" is checked. Sounds below the noise floor are not amplified. Sounds with volumes between the noise floor and the new threshold (after downward compression and calculation of the amount of amplification possible after this compression?) have their volumes "stretched" to fit the new range. I you'd like I'd be happy to put some screenshots and a detailed step-by-step procedure on the talk page.

Are you getting a feeling of deja vu here?
reducing the dynamic range of the audio. One of the main purposes of reducing dynamic range is to permit the audio to be amplified further (without clipping) than would be otherwise possible. Therefore by default Compressor amplifies audio as much as possible after compression. The resultant increase in average or RMS level can be useful for audio played in a noisy background, such as in a car stereo, or in speech, to make a distant voice sound as loud as a close one.
Accessed by: Effect > Compressor...
Compressor settings window
ToDo Old text "Compressing the louder sounds gives more headroom for amplifying the fainter sounds without causing clipping" and "Because the gain changes relatively slowly, a compressor does not distort the signal in the way that a Limiter or clipping would do." should be worked in or not, as thought best, and section written for graph describing what the axes mean. Then probably work in the two images at the bottom. Gale

Graph

The graph shows the input level along the bottom (x-axis) and the output level along the left (y-axis). Note that the graph always goes through the (0,0) point at the upper right - this is consistent with the "Make-up gain for 0 dB after compressing" option. The graph will change as you adjust the sliders.

Controls

  • Threshold: Sounds above this threshold will cause the compressor to reduce the level of the audio. It sets the horizontal (left to right) position of the corner of the blue line on the graph.
  • Noise Floor: Sets the level below which make-up gain will not be applied. This prevents the compressor from amplifying noise.
Steve the Fiddle When "Compress based on peaks" is NOT selected, the effect applies "downward expansion" below the Noise Floor. This will approximately compensate for the increase in gain produced by the "make-up gain" so the net effect is approximately unity gain below the Noise Floor.

When "Compress based on peaks" IS selected, the effect leaves sound below the Noise Floor unchanged, and upwardly expands between the Noise Floor and the Threshold, thus producing reduced (compressed) dynamic range above the Threshold.

Bill: OK, I'll accept that, but it implies that the noise floor setting is not relevant when "compress based on peaks" is not checked and "make-up gain" is not checked, right? And would you agree that the "upward expansion" cannot happen unless the "downward compression" takes place above the threshold?
  • Ratio: The amount of compression applied to the audio once it passes the threshold level. The higher the Ratio the more the loud parts of the audio will be turned down. The Ratio sets the slope of the blue line on the graph above the corner.
  • Attack Time: How soon the compressor starts to reduce the volume level after it rises above the threshold. If volume changes are slow, you can push this to a high value. Short attack times will result in a fast response to sudden, loud sounds, but will make the changes in volume much more obvious to listeners.
  • Decay Time: How soon the compressor starts to increase the volume level back to normal after the level drops below the threshold. A long time value will tend to lose quiet sounds that come after loud ones, but will avoid the volume being raised too much during short quiet sections like pauses in speech.
  • Make-up gain for 0 dB after compressing: Boosts the resultant audio after compression equally at all volume levels, to be as loud as possible without distortion. Because the compressor works by making loud sections quieter, you will usually want to do this. If this option is selected, the effect will be both to make the quiet sections of the audio louder, and increase the overall loudness.
  • Compress based on Peaks: The threshold setting will react to the peak values of the waveform rather than the average value.
When "Compress based on Peaks" is checked, make-up gain is always applied regardless of the setting of the make-up gain checkbox.
Steve the Fiddle No it's not. It appears to be because when "Compress based on Peaks" is checked the effect uses upward compression

Bill: OK, I've done some more testing. I can create cases where there is a slight difference when "make-up gain" is ON versus OFF. In one test I did you could further amplify the compressed wave by 1 dB when "make-up gain" was OFF.
But there's that "upward compression" (expansion?) description again. If you treat this effect like a black box, give it a known input and look at the output, this is what appears to happen when "compress based on peaks" is checked. 1) Downward compression is applied to sounds above the threshold. 2) An amplification factor "A" is calculated based on the new peak amplitude of the selection (but it doesn't always get it right). 3) Sounds with volumes above the threshold are amplified by this factor. 4) Sounds below the noise floor are not amplified. 5) Sounds with volumes between the noise floor and the threshold are amplified by a factor between 1 and "A" depending on where their pre-compression volume was. Of course it doesn't actually work that way in the code, but this is the net effect.

<rant on>IMO this effect has become way too complex. Here's Steve and me, two experienced audio engineers, debating the fine points of how this effect actually works. What we want on this page is something that novice users can understand. It has been said that Steve Harris' SC-4 compressor is too complex for novice users, but compared to what Compressor has become I am beginning to question that. And at least SC-4 behaves like a real-world hardware compressor. I've read Steve's very good description of the effect of the noise floor setting and how it changes based on the setting of "compressed based on peaks" and I understand now what it does - the difference is subtle put important. Do we want to expose novice users to these esoteric technical nuances? All they want to know is "does it make my song louder and how does it do it".<rant off>


Schematic example

Uncompressed:

A simple sine wave that drops off by 6 dB half way through the selection, to demonstrate how some compressors handle signals.

Uncompressed signal
After:

The attack part of where the compressor is working is clearly visible at the start of the audio.The release part still affects some audio that is beneath the threshold as the compressor gain change slowly ebbs out and the material fades back to normal level.

Compressed signal