I'm trying to implement a 'Compressor/Expander/Noise gate' for automatic gain control of audio signals. The block diagram of the system is shown below:

Block diagram of a Compressor/Expander/Noise gate

I don't understand how the 'Range Detector' selects the appropriate output, given that for some values of xRMS(n), both the output of the expander and noise gate are non-zero.


1 Answer 1


According to the source that your block diagram is taken from [Udo Zölzer - Digitale Audiosignalverarbeitung], the Range Detector is an arbiter whose decision is not based on the output of the three nodes, but rather on the region of operation of the static characteristic that your calculated $x_{RMS}(n)$ is found in: static characteristic So, if $x_{RMS}(n)$ is below $NT$, the range detector chooses the lower node, if it is above $CT$, it chooses the upper node...

As you already noticed, that block diagram does have a few shortcomings when it comes to implementation:

  • It does not take into account edge cases like $|ET| > |CT|$
  • There are more regions of operation than branches to process the RMS value. Even in the case where your RMS value is above expander threshold but below compression threshold you would be required to perform a set of logarithmic, multiplication, comparison, addition and exponential operations. But it would be computationally more efficient to calculate whether $2 ^ {2 * ET} < x_{RMS}(n) < 2 ^{2 * CT}$ evaluates to true and if yes, you can set $f(n) = 1$ immediately without having to calculate $log_2(x_{RMS}(n))$ and so forth.
  • The lowest branch is not actually a noisegate but another expander with a (presumably) steeper slope. Zoelzer defines the slope as $S = 1 - \frac{1}{R}$ while a Noisegate's ratio is defined as $R = 0$. As you can see, the slope would thus evaluate to $NS = -\inf$ and the calculation of the whole lower branch becomes rather pointless. Again, it would be more efficient to set $f(n)$ directly to $0$ in the case $x_{RMS} < 2 ^{2 * NT}$ and save yourself a few pointless calculations.

As a matter of fact, Zoelzer seems to agree with the last point and provided a sligtly different block diagram in the book DAFX: enter image description here

Please excuse the poor image quality. I highly recommend you get this book as well. It is a great addition to Digital Audio Signal Processing and provides Matlab demo code for most topics, dynamics processing included.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.