Audio dynamic range compressor built from basic elements.
A measurement of mean-square audio amplitude is used to generate a gain-reduction control signal (in red) which is
multiplied by the input, thus compressing the output amplitude below the user-defined threshold. The logarithm block is
required to convert the mean-square measurement to dB. The Compressor Threshold block compares the measured
mean-square value (in dB) with the user-defined dB threshold (slider in the Compressor Threshold block), and generates a
gain-reduction signal of a desired "compression ratio" if the mean-square value exceeds the threshold. The antillog of the
control signal is taken (to convert back from dB). This signal is then smoothed and multiplied by a delayed version of the
input audio signal, thus limiting the amplitude of the output audio signal. The gain smoother has a hysteresis loop to
determine whether the compressor is in the attack or release phase. The delay gives the system a predictive
("look-ahead") capability. The output gain is required to compensate for large compression ratios. Experiment with the
settings of all blocks to explore the behaviour of the compressor.