## NonlinearFilter Example: Dynamic Range Compression

A simple practical example of a nonlinear filtering operation is dynamic range compression, such as occurs in Dolby or DBX noise reduction when recording to magnetic tape (which, believe it or not, still happens once in a while). The purpose of dynamic range compression is to map the natural dynamic range of a signal to a smaller range. For example, audio signals can easily span a range of 100 dB or more, while magnetic tape has a linear range on the order of only 55 dB. It is therefore important to compress the dynamic range when making analog recordings to magnetic tape. Compressing the dynamic range of a signal for recording and then expanding it on playback may be called companding (compression/expansion).

Recording engineers often compress the dynamic range of individual tracks to intentionally flatten'' their audio dynamic range for greater musical uniformity. Compression is also often applied to a final mix.

Another type of dynamic-range compressor is called a limiter, which is used in recording studios to soft limit'' a signal when it begins to exceed the available dynamic range. A limiter may be implemented as a very high compression ratio above some amplitude threshold. This replaces hard clipping'' by soft limiting,'' which sounds less harsh and may even go unnoticed if there were no indicator.

The preceding examples can be modeled as a variable gain that automatically turns up the volume'' (increases the gain) when the signal level is low, and turns it down when the level is high. The signal level is normally measured over a short time interval that includes at least one period of the lowest frequency allowed, and typically several periods of any pitched signal present. The gain normally reacts faster to attacks than to decays in audio compressors.

### Why Dynamic Range Compression is Nonlinear

We can model dynamic range compression as a level-dependent gain. Multiplying a signal by a constant gain (volume control''), on the other hand, is a linear operation. Let's check that the scaling and superposition properties of linear systems are satisfied by a constant gain: For any signals , and for any constants , we must have

Since this is obviously true from the algebraic properties of real or complex numbers, both scaling and superposition have been verified. (For clarity, an explicit '' is used to indicate multiplication.)

Dynamic range compression can also be seen as a time-varying gain factor, so one might be tempted to classify it as a linear, time-varying filter. However, this would be incorrect because the gain , which multiplies the input, depends on the input signal . This happens because the compressor must estimate the current signal level in order to normalize it. Dynamic range compression can be expressed symbolically as a filter of the form

where denotes a gain that depends on the current level'' of at time . A common definition of signal level is rms level (the root mean square'' [84, p. 75] computed over a sliding time-window). Since many successive samples of are needed to estimate the current level, we cannot correctly write for the gain function, although we could write something like (borrowing matlab syntax), where is the number of past samples needed to estimate the current amplitude level. In general,

That is, the compression of the sum of two signals is not generally the same as the addition of the two signals compressed individually. Therefore, the superposition condition of linearity fails. It is also clear that the scaling condition fails.

In general, any signal operation that includes a multiplication in which both multiplicands depend on the input signal can be shown to be nonlinear.

Next Section:
A Musical Time-Varying Filter Example
Previous Section:
Showing Linearity and Time Invariance, or Not