For other uses, see Dither (disambiguation).

A grayscale image represented in 1-bit black-and-white space with dithering

**Dither** is an intentionally applied form of noise used to randomize quantization error, preventing large-scale patterns such as color banding in images. Dither is routinely used in processing of both digital audio and video data, and is often one of the last stages of mastering audio to a CD.

A common use of dither is converting a greyscale image to black and white, such that the density of black dots in the new image approximates the average grey level in the original.

## Etymology

…[O]ne of the earliest [applications] of dither came in World War II. Airplane bombers used mechanical computers to perform navigation and bomb trajectory calculations. Curiously, these computers (boxes filled with hundreds of gears and cogs) performed more accurately when flying on board the aircraft, and less well on ground. Engineers realized that the vibration from the aircraft reduced the error from sticky moving parts. Instead of moving in short jerks, they moved more continuously. Small vibrating motors were built into the computers, and their vibration was called dither from the Middle English verb “didderen,” meaning “to tremble.” Today, when you tap a mechanical meter to increase its accuracy, you are applying dither, and modern dictionaries define dither as a highly nervous, confused, or agitated state. In minute quantities, dither successfully makes a digitization system a little more analog in the good sense of the word.

The term *dither* was published in books on analog computation and hydraulically controlled guns shortly after World War II. Though he did not use the term *dither*, the concept of dithering to reduce quantization patterns was first applied by Lawrence G. Roberts in his 1961 MIT master’s thesis and 1962 article.^{ }By 1964 dither was being used in the modern sense described in this article.

## In digital processing and waveform analysis

Dither is utilized in many different fields where digital processing and analysis are used. These uses include systems using digital signal processing, such as digital audio, digital video, digital photography, seismology, radar and weather forecasting systems.

Quantization yields error. If that error is *correlated* to the signal, the result is potentially cyclical or predictable. In some fields, especially where the receptor is sensitive to such artifacts, cyclical errors yield undesirable artifacts. In these fields introducing dither converts the error to random noise. The field of audio is a primary example of this. The human ear functions much like a Fourier transform, wherein it hears individual frequencies. The ear is therefore very sensitive to distortion, or additional frequency content, but far less sensitive to additional random noise at all frequencies such as found in a dithered signal.

## Digital audio

In an analog system, the signal is *continuous*, but in a PCM digital system, the amplitude of the signal out of the digital system is limited to one of a set of fixed values or numbers. This process is called quantization. Each coded value is a discrete step… if a signal is quantized without using dither, there will be quantization distortion related to the original input signal… In order to prevent this, the signal is “dithered”, a process that mathematically removes the harmonics or other highly undesirable distortions entirely, and that replaces it with a constant, fixed noise level

The final version of audio that goes onto a compact disc contains only 16 bits per sample, but throughout the production process, a greater number of bits are typically used to represent the sample. In the end, the digital data must be reduced to 16 bits for pressing onto a CD and distributing.

There are multiple ways to do this. One can, for example, simply discard the excess bits – called *truncation.* One can also *round* the excess bits to the nearest value. Each of these methods, however, results in predictable and determinable errors in the result. Using dither replaces these errors with a constant, fixed noise level.

## Examples

Take, for example, a waveform that consists of the following values:

1 2 3 4 5 6 7 8

If the waveform is reduced by 20%, then the following are the new values:

0.8 1.6 2.4 3.2 4.0 4.8 5.6 6.4

If these values are truncated it results in the following data:

0 1 2 3 4 4 5 6

If these values are rounded instead it results in the following data:

1 2 2 3 4 5 6 6

For any original waveform, the process of reducing the waveform amplitude by 20% results in regular errors. Take for example a sine wave that, for some portion, matches the values above. Every time the sine wave’s value hit 3.2, the truncated result would be off by 0.2, as in the sample data above. Every time the sine wave’s value hit 4.0, there would be no error since the truncated result would be off by 0.0, also shown above. The magnitude of this error changes regularly and repeatedly throughout the sine wave’s cycle. It is precisely this error which manifests itself as distortion. What the ear hears as distortion is the additional content at discrete frequencies created by the regular and repeated quantization error.

A plausible solution would be to take the 2 digit number (say, 4.8) and round it one direction or the other. For example, it could be rounded to 5 one time and then 4 the next time. This would make the long-term average 4.5 instead of 4, so that over the long-term the value is closer to its actual value. This, on the other hand, still results in determinable (though more complicated) error. Every other time the value 4.8 comes up the result is an error of 0.2, and the other times it is −0.8. This still results in a repeating, quantifiable error.

Another plausible solution would be to take 4.8 and round it so that the first four times out of five it is rounded up to 5, and the fifth time it is rounded to 4. This would average out to exactly 4.8 over the long term. Unfortunately, however, it still results in repeatable and determinable errors, and those errors still manifest themselves as distortion to the ear.

This leads to the *dither* solution. Rather than predictably rounding up or down in a repeating pattern, it is possible to round up or down in a random pattern. If a series of random numbers between 0.0 and 0.9 (ex: 0.6, 0.1, 0.3, 0.6, 0.9, etc.) are calculated and added to the results of the equation, two times out of ten the result will truncate back to 4 (if 0.0 or 0.1 are added to 4.8) and eight times out of ten it will truncate to 5. Each given situation has a random 20% chance of rounding to 4 or 80% chance of rounding to 5. Over the long haul this will result in results that average to 4.8 and a quantization error that is random noise. This noise result is less offensive to the ear than the determinable distortion that would result otherwise.

## Usage

Dither is added before any quantization or re-quantization process, in order to de-correlate the quantization noise from the input signal and to prevent non-linear behavior (distortion). Quantization with lesser bit depth requires higher amounts of dither. The result of the process still yields distortion, but the distortion is of a random nature so the resulting noise is, effectively, de-correlated from the intended signal.

In a seminal papers published in the AES Journal, Lipshitz and Vanderkooy pointed out that different noise types, with different probability density functions (PDFs) behave differently when used as dither signals, and suggested optimal levels of dither signal for audio. Gaussian noise requires a higher level of added noise for full elimination of distortion than noise with rectangular or triangular distribution. Triangular distributed noise also minimizes *noise modulation* – audible changes in the volume level of residual noise behind quiet music that draw attention to the noise.

Dither can be useful to break up periodic limit cycles, which are a common problem in digital filters. Random noise is typically less objectionable than the harmonic tones produced by limit cycles.

## Different types

Rectangular probability density function (RPDF) dither noise has a uniform distribution; any value in the specified range has the same probability of occurring.

Triangular probability density function (TPDF) dither noise has a triangular distribution; values in the center of the range have a higher probability of occurring. Triangular distribution can be achieved by adding two independent RPDF sources.

Gaussian PDF has a normal distribution. The relationship of probabilities of results follows a bell-shaped, or Gaussian curve, typical of dither generated by analog sources such as microphone preamplifiers. If the bit depth of a recording is sufficiently great, that preamplifier noise will be sufficient to dither the recording.

Colored dither is sometimes mentioned as dither that has been filtered to be different from white noise. Some dither algorithms use noise that has more energy in the higher frequencies so as to lower the energy in the critical audio band.

Noise shaping is a filtering process that shapes the spectral energy of quantisation error, typically to either de-emphasise frequencies to which the ear is most sensitive or separate the signal and noise bands completely. If dither is used, its final spectrum depends on whether it is added inside or outside the feedback loop of the noise shaper: if inside, the dither is treated as part of the error signal and shaped along with actual quantisation error; if outside, the dither is treated as part of the original signal and linearises quantisation without being shaped itself. In this case, the final noise floor is the sum of the flat dither spectrum and the shaped quantisation noise. While real-world noise shaping usually includes in-loop dithering, it is also possible to use it without adding dither at all, in which case the usual harmonic-distortion effects still appear at low signal levels.