Dithering Demo — Noise Shaping
Hear dithering and noise shaping tame quantization distortion when reducing bit depth, with spectrum views. Interactive demo. Free in your browser, no download.
Tool controls
Protect your hearing. Start at a low volume. Never raise the volume to make a tone audible. Levels are shown in dBFS, relative to full scale — not SPL.
How it works
Quantization, TPDF dither, and psychoacoustic noise-shaping algorithms run 100% locally in browser memory. Nothing is ever uploaded or transmitted.
On this page
Dithering trades the correlated distortion of bit-depth reduction for a low, steady hiss. This demo requantises a sine to 16, 8, 6 or 4 bits with rounding, truncation, TPDF dither or a noise-shaped feedback loop, then draws the staircase and FFT locally with the Web Audio API. Nothing is uploaded.
How to use it
- Choose a bit depth. Buttons select 16, 8, 6 or 4 bits; 8-bit is the default and exaggerates the artefacts, while 16-bit is the everyday mastering case.
- Set the quantisation mode. No Dither (Round) and Truncation skip dither; TPDF adds triangular noise before rounding; Noise-Shaped adds a two-tap error-feedback filter.
- A/B the extremes. The compare control switches between TPDF Dithered and No Dither (Round) in one click, the fastest way to hear what dither changes.
- Drop the signal level. The slider runs from -10 to -60 dBFS in 5 dB steps. Start at the -30 dBFS default, then try -50 dBFS: with an 8-bit step of 0.007843, that sine is smaller than one step.
- Pick 440 Hz or 1 kHz. Both are fixed options; 1 kHz sits in the ear’s most sensitive region and makes harmonic grit easier to hear.
- Play and stop the loop. A one-second mono buffer loops through the shared browser audio engine, and switching modes while it plays restarts at the same level.
- Read the two canvases. The time view zooms to two cycles of the quantised staircase; the spectrum runs a 1024-sample Hann-windowed FFT across 256 bins, so each bin spans 43 Hz at 44.1 kHz.
Truncation, rounding and correlated error
Quantisation maps each sample onto a grid of step Q = 2 / (2^bits - 1), so the error e[n] = x[n] - Q * round(x[n] / Q) is a deterministic function of the signal.
That determinism is the problem. When a sine is rounded or truncated without dither, the error repeats once per cycle, and repetition in the time domain means discrete harmonics in the frequency domain: odd-order tones at 3f, 5f and 7f that make quiet passages sound buzzy. At -30 dBFS into 8 bits a sine spans roughly four steps peak-to-peak, which is audible. At -50 dBFS the whole waveform is smaller than one step, so truncation snaps it between codes and the tone collapses toward a rough square. Truncation also biases the error downward and adds a DC offset; rounding removes the offset but not the correlation.
TPDF dither: what it fixes and what it costs
TPDF dither adds two independent uniform random values, each spanning half an LSB, before rounding. Their sum has a triangular probability density spanning plus or minus one LSB, or two LSB peak-to-peak.
With dither present, the expected error for any input value is zero, so the error stops tracking the waveform and harmonic distortion becomes a stationary noise floor. The cost is about 4.8 dB of added broadband noise at 16 bits; what that buys is the removal of distortion and noise modulation, which is why TPDF is standard in mastering chains. The difference is easiest to hear on the -50 dBFS sine: undithered it crumbles into codes, dithered it stays recognisably a sine underneath the hiss. Dither is applied once, immediately before the final rounding to the target depth.
Noise shaping: moving noise where hearing is weakest
Noise shaping feeds the quantisation error back through a filter, which tilts the noise spectrum without changing its total power. The loop here uses two coefficients, 0.95 and 0.45: each sample is quantised after adding 0.95 times the previous error and subtracting 0.45 times the error before that, and the resulting error is fed back in turn.
| Bit depth | Quantisation step Q | Step level | Rounding error RMS | Nominal dynamic range |
|---|---|---|---|---|
| 16-bit | 0.0000305 | -90.3 dBFS | -101.1 dBFS | 96.3 dB |
| 8-bit | 0.0078431 | -42.1 dBFS | -52.9 dBFS | 48.2 dB |
| 6-bit | 0.0317460 | -30.0 dBFS | -40.8 dBFS | 36.1 dB |
| 4-bit | 0.1333333 | -17.5 dBFS | -28.3 dBFS | 24.1 dB |
The error-RMS column assumes rounding error spread evenly across one step; the audible floor also depends on level and spectrum. The FFT colour makes the mode visible: rounding and truncation paint orange harmonic spikes, while TPDF and noise-shaped modes paint a green floor that tilts upward toward the top of the band, with a trough through the midrange where hearing is most sensitive. Commercial shapers such as POW-r and UV22HR use longer, ear-weighted filters than the two-tap loop here; the principle is the same.
For the production workflow, including when to dither and why it belongs at the end of the chain, see Dithering in Digital Audio.
Accuracy, limits and troubleshooting
- The demo requantises a one-second sine at the host sample rate and loops it; it models bit-depth reduction, not a converter.
- The FFT window is 1024 samples, or 43 Hz per bin at 44.1 kHz. That shows harmonic families and noise tilt but cannot resolve low harmonics below about 100 Hz.
- Readouts assume symmetric full-scale quantisation with Q = 2 / (2^bits - 1). Converter hardware uses its own reference levels.
- The noise-shaped mode clamps the feedback sum at full scale, so a hot signal can add flat-topped peaks; keep the level at or below -10 dBFS with shaping engaged.
- Busy material responds differently: on dense music, undithered rounding can be hard to tell from dither in a quick listen. Compare on quiet fades, reverb tails and solo instruments.
- Playback passes through the OS mixer, where Windows enhancements or Bluetooth codecs can colour it; the canvases are computed from the quantised buffer, so they stay clean.
- The test tone loops. Keep the level moderate, because sustained tones at high output are an exposure risk.
Related tools
- THD Test — measure the harmonic distortion that undithered quantisation creates.
- Spectrum Analyzer — inspect shaped noise floors and spurious tones on a live FFT.
- Audio Oscilloscope — view the quantised staircase and flat-topped peaks in the time domain.
Frequently asked questions
What is audio dithering?
Dithering is the intentional addition of low-level randomized noise (specifically Triangular Probability Density Function noise, or TPDF) to an audio signal prior to reducing its bit depth (such as converting 24-bit studio masters to 16-bit distribution). It completely eliminates correlate quantization distortion.
Why is non-dithered bit reduction bad?
When reducing bit depth without dither, audio below the least significant bit (LSB) is truncated or rounded to static steps. This creates harsh, signal-correlated harmonic and intermodulation distortion. At low signal levels, smooth sine waves collapse into buzzy square waves or drop out into unnatural silence.
Does dither eliminate distortion or just hide it?
Mathematically, TPDF dither completely eradicates harmonic distortion. It converts deterministic non-linear error into benign, uncorrelated stationary white noise. Remarkable psychoacoustic proof: signals quieter than the quantization step size can still be heard cleanly beneath the noise floor!
How does noise shaping improve audio?
Noise shaping feeds quantization errors through an error-feedback filter that alters the frequency distribution of the dither noise. It shifts noise energy out of human ears' most sensitive hearing region (1 kHz to 4 kHz) into ultrasonic or high frequencies (>15 kHz), providing an apparent 10 dB to 15 dB boost in perceived dynamic range.