Tweets by @dsprelated

A Quadrature Signals Tutorial: Complex, But Not Complicated

Understanding the 'Phasing Method' of Single Sideband Demodulation

Complex Digital Signal Processing in Telecommunications

Introduction to Sound Processing

Introduction of C Programming for DSP Applications

Markus received his Dipl. Ing. degree in electrical engineering / communications in 1999. Work interests include RF transceiver system design, implementation, modeling an...show full bio

**Would you like to be notified by email when mnentwig publishes a new blog?**

Follow @DSPRelated

**Keywords: **Quantization noise; noise shaping

*A brief introduction to noise shaping, with firm resolve not to miss the forest for the trees. We may still stumble over some assorted roots. Matlab example code is included.*

Fig. 1 shows a digital signal that is reduced to a lower bit width, for example a 16 bit signal being sent to a 12 bit digital-to-analog converter. Rounding to the nearest output value is obviously the best that can be done to minimize the error of each sample.

Figure 1: Quantization (reduction of bit width)

At least for noise-like signals (other signals may require dithering, which is out-of-scope here), the quantization error of each sample is independent, and the spectrum of the error is white. That is, it has equal power density at all frequencies.

Noise shaping can lower the quantization noise *in some bandwidth of interest*, but the price is always an increase in overall noise.

How does it work? The known quantization error of an output sample is used as the first sample of an arbitrary impulse response *h _{target}*, and the impulse response is completed by adding its remaining part later to the original signal, before quantization.

The impulse response

Figure 2 shows the impulse response

Figure 2: Noise shaping: Quantization error becomes the first sample of an impulse response

Figure 3 shows the block diagram of a noise shaper that implements this idea.

Figure 3: Block diagram of noise shaper

Conceptually, the quantization error of each sample is calculated by subtracting the quantizer output from the input. An actual implementation might simply use the truncated bits.

This quantization error is now considered to be the first sample of a desired noise impulse response *h _{target}*. It is sent to a digital filter

*H _{target}* can be thought of as a digital filter that transforms random, white noise into the desired noise spectrum (it is also

The calculation is straightforward if one remembers that the first output sample of an IIR filter depends only on

Figure 4: Derivation of noise shaper filter from targeted frequency response

Fig. 4 shows the calculation. *H _{shaper}* can be found by comparing coefficients of

The noise shaper can enforce any arbitrary *shape* to the noise spectrum, but there is a catch: As *H _{shaper}* is normalized (divided) by the first sample of

For the same reason, a minimum-phase frequency response in

The

To illustrate this fundamental limitation, Figures 5 and 6 show two example frequency responses. The first (Fig. 5) attempts noise rejection only over a narrow frequency span. The resulting impulse response is well-behaved, with a large first sample.

Figure 5: Attempt to suppress noise in a narrow bandwidth only (good)

The second frequency response (Fig. 6) attempts strong noise rejection over a much wider bandwidth. Its impulse response has a rather small first sample - barely visible in the plot - and normalizing this sample to "1" will cause the remaining impulse response to contribute a high level of unwanted noise, possibly achieving exactly the opposite of what was intended.

Figure 6: Attempt to achieve wide-band noise suppression (bad)

A Matlab / OctaveForge example is available for download (link at bottom of page). It designs an IIR bandstop filter for *H _{target}*, as shown in Fig. 7, with a 4 MHz notch around 31 MHz at a sampling rate of 76.8 MSPS.

Figure 7: Example

The filter is then converted into a noise shaper (using equations from Fig. 4), and applied to quantize a random signal. The resulting quantization error spectrum is shown in Fig. 8 (magenta), together with the equivalent output of a conventional quantizer without noise shaping (red).

Quantization error in the stopband of the filter is clearly reduced, whereas the total quantization error (integrated over all frequencies) increases as expected.

Figure 8: quantized output spectrum with and without noise shaping

Finally, Figure 9 shows input and output signals in the time domain.

Figure 9: input and output waveform

Looking at Figure 9, it should not be surprising that the structure in Fig. 3 oscillates by design: The differential gain of the quantizer in the feedback loop approaches infinity for levels close to any switching threshold. This is acceptable, because the error caused by an unlimited stairstep quantizer never exceeds half a "stairstep" in either direction. For bounded input, also bounded output of the filter may be guaranteed.

A multi-bit signal can be dimensioned so that digital clipping is a rare or even impossible event. One could make a solid argument that the objective for the noise shaper is to manage *quantization*, not *clipping*. Noise shaping on a wide bitwidth is common for example for the word length reduction of audio signals [1], such as the final step in mastering for 16-bit CD audio.

Noise shaping is also used in applications, where *clipping* is part of normal operation (i.e. *one-bit* sigma-delta modulation). Now no amplitude limit to the quantization (clipping) error is enforced. The noise shaping filter suddenly finds itself embedded in an instable feedback loop without amplitude limit. Signal values "run away" and the structure becomes non-functional.

Further discussion of the clipping problem can be found in [2] at the end of section 1. The design of *stable* sigma-delta modulators is a well-researched topic, but out-of-scope here.

This brief article introduces noise shaping by considering quantization error as first sample of a designed impulse response. An example program is included.

The program (Octave / Matlab) can be downloaded here . It requires this spectrum analyzer subroutine in the same folder.

[1] Hydrogen Audio: Noise shaping Wiki

[2] Why 1 bit Sigma-Delta conversion is unsuitable for High Quality applications

[3] When is noise shaping useful? comp.dsp discussion

Markus received his Dipl. Ing. degree in electrical engineering / communications in 1999. Work interests include RF transceiver system design, implementation, modeling and verification. He works as senior architect for Renesas Mobile Europe in Finland.

Previous post by Markus Nentwig:

Next post by Markus Nentwig:

Comments / Replies

There are no comments yet!

Sorry, you need javascript enabled to post any comments.