ArticleslgStudy

computer science

Dither

Dither is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Dither rather than just read about it. In short: Dither or dithering 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.

Dither — main illustration
Dither — illustration

Key takeaways

  • Dither belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Dither to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Dither from memory before moving on to harder problems.

Reference excerpt

Dither or dithering 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 grayscale image to black and white, so that the density of black dots in the new image approximates the average gray level in the original.

Etymology 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. The technique was in use at least as early as 1915, though not under the name dither.

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. This must be reduced to 16 bits to make the CD. 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 determinable errors. Using dither replaces these errors with a constant 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 that 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. However, this 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.) is generated and added to the 4.8, 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, these results will average to 4.8 and their quantization error will be random noise. This noise is less offensive to the ear than the determinable distortion that other solutions would produce.

… excerpt ends here. Continue reading the full article.

Illustrations

Dither illustration
Dither illustration
Dither: An illustration of dithering. Red and blue are the only colors used, as the red and blue squares are made smaller, the patch appears magenta.
An illustration of dithering. Red and blue are the only colors used, as the red and blue squares are made smaller, the patch appears magenta.
Dither illustration
Dither illustration

Worked examples

Example 1 — a first encounter with Dither

Start with the simplest possible case. Write down what Dither claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Dither before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Dither ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Dither

In research
Dither appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Dither in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Dither is common in secondary-school and first-year university syllabi. It links to neighbouring topics Audio engineering, Computer graphic artifacts, Digital signal processing, so understanding it makes those chapters shorter.
In everyday life
Look for Dither outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Dither” →

How to study Dither in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Dither means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Dither out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Dither in simple terms?

Dither or dithering 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…

Why does Dither matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Dither?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Dither.

Tags

  • Audio engineering
  • Computer graphic artifacts
  • Digital signal processing

Keep exploring