Dither examples

来源:百度文库 编辑:神马文学网 时间:2024/06/30 21:15:13

Dither examples

There are three typical dither PDF's used in PCM digital audio, RPDF, TPDF (triangular PDF) and Gaussian PDF. We'll look at the first two.

For this section, I used MATLAB to make a sine wave with a samplingrate of 32.768 kHz. I realize that this is a strange sampling rate, butit made the graphs cleaner for the FFT analyses. The total length ofthe sine wave was 32768 samples (therefore 1 second of audio.) MATLABtypically calculates in 64-bit floating point, so we have lots ofresolution for analyzing an 8-bit signal, as I'm doing here.

To make the dither, I used the MATLAB function for generatingrandom numbers called RAND. The result of this is a number between 0and 1 inclusive. The PDF of the function is rectangular as we'll seebelow.

RPDF dither should have a rectangular probability densityfunction with extremes of -0.5 and 0.5 LSB's. Therefore, a value ofmore than half of an LSB is not possible in either the positive ornegative directions. To make RPDF dither, I made a vector of 32768numbers using the command RAND(1, n) - 0.5 where is the length of the dither signal, in samples. The result is equivalent to white noise.

Figure 8.19: Histogram of RPDF dither for 32k block. The MATLAB equation is RAND(1, 32768) - 0.5

Figure 8.20: Probability distribution function of RPDF dither for 32k block.

TPDF dither has the highest probability of being 0, and a 0 probabilityof being either less than -1 LSB or more than 1 LSB. This can be madeby adding two random numbers, each with an RPDF together. Using MATLAB,this is most easily done using the the command RAND(1, n) - RAND(1, n) where is the length of the dither signal, in samples. The reason they'resubtracted here is to produce a TPDF that ranges from -1 to 1 LSB.

Figure 8.21: Histogram of TPDF dither for 32k block. The MATLAB equation is RAND(1, 32768) - RAND(1, 32768)

Figure 8.22: Probability distribution function of TPDF dither for 32k block.

Let's look at the results of three options: no dither, RPDF dither and TPDF dither. Figure 8.23shows a frequency analysis of 4 signals (from top to bottom): (1) a64-bit 1 kHz sine wave, (2) an 8-bit quantized version of the sine wavewithout dither added, (3) an 8-bit quantized version with RPDF addedand (4) an 8-bit quantized version with TPDF added.

Figure 8.23:From top to bottom, a 64-bit sine 1 kHz wave in MATLAB, 8-bit no dither, 8-bit RPDF dither, 8-bit TPDF dither. Fs = 32768 Hz, FFT window is rectangular, FFT length is 32768 point.

One of the important things to notice here is that, although thedithers raised the overall noise floor of the signal, the resultingartifacts are wide-band noise, rather than spikes showing up atharmonic intervals as can be seen in the no-dither plot. If we were tolook at the artifacts without the original 1 kHz sine wave, we get aplot as shown in Figure 8.24.

Figure 8.24: Artifacts omitting the 1 kHz sine wave. From top to bottom, 8-bit no dither, 8-bit RPDF dither, 8-bit TPDF dither. Fs = 32768 Hz, FFT window is rectangular, FFT length is 32768 point.