top of page

Parameters: A Technical Approach

Now that we understand the basic parameters of a compressor (threshold, ratio, attack, and release) as well as what their functions are it's time we delve a little deeper into how they perform those functions.  For our analysis we will group the basic parameters into two groups, which will operate as modules in our processing: 

  • Level dectector parameters - attack and release

  • Gain computer parameters - threshold and ratio

We will also introduce the concept of sidechain processing - this will be critical later in our analysis when we see how the arrangement of our modules can have a noticible impact on our output. 

Sidechain Processing

Sidechain processing in the audio compression context is the practice of processing a copy of the input signal in parallel with the unaltered input signal in order to generate a control voltage.  The control voltage is then mixed back into the original signal which creates the output signal.  Both our gain computer and level detector module operate on the sidechain, which can be expressed and visualized as shown below.

Figure 1: Simple sidechain configuration and system output equation

Level Detection - Applying attack and release

Typically the level detector is placed first on the sidechain (though this is not always the case as we will see later) so we will cover it first.  The purpose of the level detector is to:

  • Provide an accurate representation of the input signal

  • Smooth out noise and other incidental amplitude fluctuations that we do not the compressor to operate on 

This function is realized in the digital domian using a pair of digital one-pole filters commonly known as leaky integrators, one for the attack phase (when the current input sample is greater than the previous output sample) and one for the release phase (when the current input sample is less than the previous output sample).  

Figure 2: Attack/Release based filter used in the level detection phase of compressor

The equations above lead us to our technical definition of attack and release time - they are the digital version of an analog RC time constant!  The user defined attack time therefore truly represents the amount of time it takes for the compressor to reach 63.2% of its final gain reduction after the input has crossed the threshold.  Similarly, the release time parameter is the amount of time it takes the compressor to drop from full gain reduction to 36.8% gain reduction.

Note how each output sample is determined by both the current sample and the previous output sample - this is what provides us with the smoothing function we require. Because the input sample is being multiplied by (1 - alpha) we observe a 'sliding scale' type of effect based on the value for attack and release.  If the user input value for attack or release (in seconds) is large - for example, 0.2 s as an attack time - then the output of the level detector will depend almost entirely on the previous output sample.  Conversely if the input value is small - for example, 10 microseconds - then the output of the compressor depends almost entirely on the input sample.  

 

This is exactly the behavior we desire from an audio standpoint.

 

Consider an attack time example. By setting the attack time to a slow 500 microseconds we are telling the compressor that we would like it to compress relatively slowly and ignore any fast transients.  By applying our equation above we see that this is exactly what happens - the output of the level detector is ~95% based on the output from the previous sample with only a 5% dependance on the current input sample.  Therefore, unless the input is relatively stable (i.e. not transient) the output of the level detector will not be affected by the change in the input and will not contain the transient.  This means that this portion of the signal will not exceed the threshold and no compression will be applied!

 

 If we consider the equation for release, we see the same behavior with a reverse effect.  If a signal level is trending downards the level detector will slow its decline by 'smearing' higher input values across the downward slope.  With long release times this corresponds to a compressor whose output climbs back to the level of the input more slowly than one with faster release times after the level has dropped below the threshold.

 

Gain Computing - Threshold and Ratio

The gain computer phase is where the actual reduction in level is applied based on the gain computer input.  While more complicated functions exist, the authors of this project chose to focus on a hard-knee compressor design, which implements gain computation in the form of a piecewise function shown below.

Figure 3: Piecewise function for gain computation

The function produces one of two outputs, namely pass-through output when no compression is applied and compressed output.  Compressed output is determined by the second formula listed above and can be described by the following algorithm:

  1. If the input sample is greater than the threshold, then:

  2. Subtract the threshold from the input sample

  3. Reduce the remaining input sample by a factor of R where R is the ratio

  4. Add the threshold back into the reduced sample, producing a level reduced output sample

 

As an example, consider a compressor system where the threshold is set at -10dB, the ratio is 3, and the input sample is at a level of -4 dB.  The output sample corresponding to these conditions would be :

(-4 - -10)/3 + -10 = - 8dB.  

This is correct and can be verified by thinking of the ratio as the number of input dB above the threshold it takes to increase the output by one dB.  We see then that we are 6 dB above the threshold, which should correspond to a 2 dB increase at the output (given a ratio of 3).

 

bottom of page