Previous | Table of Content | Next |
The aim of automatic gain control is much more modest: to find a good setting for the volume fader and then leave it there. You can observe the working of automatic gain control, by watching the fader in the windows mixer application going up and down. The Options menu offers an easy way to open the standard windows (XP or earlier) mixer application.
The algorithm used by m3w to find the best setting is as follows:
You can find settings of these values by experimenting with different signal sources and observing the behavior of m3w. Some examples, however, might help.
High=-6dB, Low=-40dB, Noise=-55dB, Step=2%
This is the
default setting. There is enough room for normal intervals, and we can
hope that after an initial adjustment, the gain will remain stable. At
the upper end, there might be parts of the signal that contain many
peaks above -6dB of the maximum volume, some of these will even be big
enough to exceed the maximum value and cause a cut off of the signal
(clipping). Clipping is an audible distortion if it occurs too
often. Here, we hope that it isn't too often.
At the lower end, we
will increase the gain only so much to get most intervals above the
-40dB level. Not very much, but it leaves a lot of headroom to avoid
clipping.The noise level of -55dB is quite high, but big enough to keep
the gain steady between two tracks of a recording.
The step level of 2% is small, as to make any adjustments slowly and render them
inaudible.
High=-3dB, Low=-50dB, Noise=-50dB, Step=15%
The low and
the noise level are equal. With this setting there won't be any low
intervals. This means that there is never any upward correction of the
input gain. Hence you can set your input gain manually and you still
have some assurance that the input gain will be swiftly (15%) reduced
if the level gets extremely high. You have to adjust the level back
yourself once the sound level gets normal again.
High=-10dB, Low=-20dB, Noise=-50dB, Step=4% (not a recommended setting, just an example)
The narrow
band of normal intervals will cause permanent adjustment. You have
some sort of volume compression, but only after the low or high values
have occurred. The step value (4) could be even greater to achieve even
faster adjustments, however, the overall delay of at least 5 seconds
before any adjustments are made, will remind you that you are using
automatic gain control. For these applications you should use the
volume compression feature, adjusting the volume before the peaks!
The volume compression (thanks to Philip Van Baren) is a peak detection, with an instantaneous rise, peak-hold, and then slow decay rate. The peak level is inverted using a power factor between 0 and -1 (depending on the amount of volume compression you want) to get a gain value which brings the peak level up. That gain value is low-pass-filter to smooth the gain transitions. The waveform data is delayed by 3x the time constant of the low pass filter, and then multiplied by the current gain value. This allows the gain to complete the transition smoothly, and be close to the desired gain level before the peak is reached.
It also implements a noise detection, and freezes the peak detector when there is no signal. Optionally you can also have it switch to a low gain while there is no signal present, so you don't amplify the noise floor. The switch between low gain and high gain passes through the same "rise time" low pass filter, so the "rise time" parameter controls how fast the switching occurs.
There are a few parameters, on the volume compression options dialog:
A few possible operating modes:
Various shades between these 3 modes give combined effects. The default settings of 30 ms rise, 10 sec fall, compress 20dB to 3dB, noise attenuation=6dB works well for speech, giving some volume compression along with automatic gain control, and a little bit of noise gating. Volume compression should be combined with automatic gain control, especially in settings, where m3w is used in unsupervised mode to broadcast events.
Automatic gain works as early in the signal path as possible, because once the signal is distorted by clipping (signal too high) or quantization noise (signal to low) there is no way of repair. Auto gain works by adjusting the controls of the the soundcards audio mixer. It is working best, if it does nothing, leaving the gain where it is, at a position where the signal level is neither to high nor too low. If, however, the signal is too high or too low, the input gain is adjusted slowly and in small steps (in oder not to be audible). If in doubt, keep the signal level at the low end not at the high end. A small amount of quantization noise is better then permanent clipping.
Volume compression works late in the signal path. It can not prevent clipping that has already occurred in the sound card and can not remove quantization noise that is in the signal. If, however, the loudness of the signal has great variations, within the possible dynamic range, volume compression can make the parts that have a low level louder, by selectively amplifying them. This reduces the overall dynamic range.
A smaller dynamic range is desired, if the listening conditions are not perfect. In a noisy environment, e.g. listening to music in a car, or listening to a speech as part of a larger audience, the soft parts of the signal are covered by the noise during listening. Also a limited dynamic range during transmission, for example over a telephone line, or within a largely compressed bitstream, will benefit from a compressed signal.
The advantage of volume compression in a streaming application like m3w, is the ability to adjust amplification based not only on the current and past signal level, but also on the future signal level. This is achieved, by a small look ahead buffer, where the signal is inspected before being processed. Therefore the amount of amplification can be reduced gradually before the input signal turns loud again.
Here is my recommendation, if for example you do unsupervised broadcasting of
live events mainly with speakers (discussions, church services, and so on):