# What does the operator 'Range Detector' do in this block diagram? How can it be modeled?

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:

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.

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: 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...
• 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.