Where a signal becomes a number

One step of dither per moment

A whole step of uniform dither makes a quantiser's error average to zero wherever the input sits, and leaves its power at x(1 − x) steps²: zero at a code and a quarter between codes, so the noise rises and falls with the signal. Two steps — a triangular dither — hold the power at a quarter everywhere and leave the third moment swinging by 0.096 steps³; three steps fix that too. Each added step fixes one more moment of the error and costs a twelfth of a step² of power: 3.01 dB for one, 4.77 for two. Subtracted after the converter, one step fixes the error's whole distribution for 0.00 dB.

Assumes: The floor a converter sets · One bit, and where the noise went

When a floor stops being a floor found a quantiser’s error turning from noise into distortion as the input used fewer levels — 76 per cent of the error’s power locked into harmonics of a signal crossing one and a third levels — and found that a dither of one whole step breaks the lock. The dither that is a decision then swept the dither’s size and found a corner at one step: below it the error stays locked to the signal, above it the harmonic share sits at a few tenths of a per cent while the price in noise climbs as 10log⁡10(1+L2)10\log_{10}(1 + L^2).

Both measured one property of the error — how much of its power sits at the signal’s harmonics — and found one step sufficient. That property is the error’s mean given the signal: an error whose average depends on the input is a distortion, and a whole step of uniform dither makes that average zero. But an error has a distribution, not just a mean, and its other moments can depend on the signal too. Its power can rise and fall with the input while its mean stays at zero, and a listener hears that as noise that breathes with the music.

This essay measures the error’s first three moments as functions of where the input sits between two codes, for dithers built from one, two and three uniform steps and for a dither that is subtracted after the converter, and finds a rule that is clean enough to state in one line.

The quantisation error's power as a function of where the input sits, for four dithers. computed by solving, not by drawing; the error's mean square given the input, integrated over each dither's density through the converter's own quantiser, and checked against seeded draws to 6 × 10⁻³. Undithered it is the square of a sawtooth, x² up to half a step and (1 − x)² beyond. One uniform step makes it x(1 − x): zero at a code, a quarter of a step² between codes — the error's power is carried by the signal. Two steps (triangular) hold it at ¼ everywhere, and one step subtracted after the converter at 1/12 everywhere. Averaged over the input the prices are 3.01, 4.77 and 0.00 dB against the undithered 1/12.
Fig. 1 The quantisation error’s power given where the input sits between two codes, for four dithers. Undithered it is the square of a sawtooth. One uniform step makes it x(1 − x): zero at a code and a quarter of a step² between codes. Two steps hold it at ¼ everywhere; one step subtracted after the converter holds it at 1/12. Averaged over the input the prices are 3.01, 4.77 and 0.00 dB against the undithered 1/12.

The moments, computed two ways

The quantity measured is the conditional moment E[em∣x]E[e^m \mid x]: the average of the error’s m-th power, given that the input sits a fraction x of a step above a code. The error is the quantiser’s output minus the input; for the subtractive case it is the output minus the input minus the dither, because the dither is removed after conversion.

The quantiser is the converter model the earlier measurements used, called at every point; nothing here is a formula for rounding. The dither is a sum of n uniform variables each one step wide, centred on zero, whose density is the Irwin–Hall density — a box for one, a triangle for two, a piecewise quadratic for three. The moment is integrated over that density by the midpoint rule, four thousand points across its support, at forty-one positions of the input between two codes.

The second route draws the dither instead: twenty thousand values from a seeded generator, each passed through the quantiser, the error’s power averaged. The two agree to six parts in a thousand, which is the draw’s own scatter at that sample size. Everything below is from the integration, which has no scatter.

One step fixes the mean

With no dither the error at a given input is fixed: a sawtooth that is zero at a code, rises to half a step just below the midpoint between codes and falls back. Its mean given the input is the sawtooth itself.

The quantisation error's mean as a function of where the input sits. computed by solving, not by drawing. Undithered the mean error is the error itself, a sawtooth from 0 to ±½ step: a distortion locked to the input. One uniform step, and two, make it zero at every input to the integration's precision — the property the earlier sweeps measured as the error's harmonic share falling to a few tenths of a per cent. The first moment is what one step of dither fixes. It is not the only moment.
Fig. 2 The error’s mean given where the input sits. Undithered it is the error itself, a sawtooth from 0 to ±½ step — a distortion locked to the input. One uniform step and two make it zero at every input to the integration’s precision.

One uniform step of dither makes the mean zero at every input. The argument is short: with the input a fraction x above a code, a box of dither one step wide carries it over the next code with probability exactly x, so the output is the upper code with probability x and the lower with probability 1−x1 - x, and its average is exactly the input. This is the result the earlier measurements saw as the error’s harmonic share collapsing: an error whose mean does not depend on the signal cannot put a fixed fraction of the signal back as harmonics.

One step does not fix the power

The same picture says what one step leaves behind. The output is one of two codes with probabilities x and 1−x1 - x, so the error is 1−x1 - x or −x-x with those probabilities, and its mean square is

E[e2∣x]=x(1−x).E[e^2 \mid x] = x(1-x).

That is zero when the input sits on a code — the dither never carries it anywhere — and a quarter of a step² midway between codes. The integrated moment follows x(1−x)x(1-x) to the integration’s precision across all forty-one positions. Averaged over the input it is a sixth, twice the undithered twelfth: the 3.01 decibels that the dither that is a decision found as the price of one step.

But the average hides the shape. The error’s power depends on where the signal is, so a signal that moves slowly through the codes carries a noise that swells between codes and vanishes on them.

The error's power through a slow sine of 3.3 steps, in 256-sample windows, under one and two steps of dither. computed by solving, not by drawing, seeded draws. Under one step the window power swings by 0.241 steps² as the sine passes through codes and between them — the error's loudness follows the signal, which a listener hears as noise that breathes. Under two steps it holds at a quarter, swinging only by 0.097, the draw's own scatter. The first figure's x(1 − x), met by a real signal.
Fig. 3 The error’s power through a slow sine of 3.3 steps’ amplitude, in 256-sample windows, under one and two steps of dither. Under one step the window power swings by 0.241 steps² as the sine passes through codes and between them. Under two it holds at a quarter, swinging only by 0.097 — the draw’s own scatter at this window length.

Through a slow sine of a few steps, the windowed error power under one step of dither rises and falls with the waveform, swinging over almost the whole range from zero to a quarter. This is noise modulation: the noise is not distortion — it contains no harmonics of the signal — but its loudness is a function of the signal, and in audio a faint signal fading through a quantiser is heard with a hiss that follows it in and out. Under two steps the same windows hold at a quarter, and their remaining scatter is the randomness of the draw, not a dependence on the signal.

Two steps fix the power

A triangular dither — the sum of two uniform steps, two steps wide in total — holds the error’s power at exactly a quarter of a step² wherever the input sits. The integrated moment is flat across all forty-one positions to two parts in a thousand, and the mean is still zero. The price is the average power, a quarter against the undithered twelfth: 4.77 decibels.

That is the standard choice in audio mastering and in measurement converters, and this is why: it is the cheapest dither that makes the error’s power, as well as its mean, independent of the signal. It costs 1.76 decibels more than one step and buys a noise floor that does not breathe.

Three steps fix the third

The pattern invites a question: if one step fixes the first moment and two fix the second, what of the third?

The error's third moment given the input: a triangular dither of two steps, and a dither of three. computed by solving, not by drawing. With two uniform steps the error's mean and power no longer depend on the input, but its third moment does, swinging over 0.0960 steps³ as the input moves between codes. With three it is flat to 2.6e-4. A dither built from n uniform steps makes the first n moments of the error independent of the signal, and the n-th is the last one it fixes.
Fig. 4 The error’s third moment given the input, under a triangular dither of two steps and under a dither of three. With two steps the mean and power no longer depend on the input, but the third moment swings over 0.0960 steps³ as the input moves between codes. With three it is flat to 2.6 × 10⁻⁴.

Under two steps the third moment — the error’s skewness, scaled — swings by 0.096 steps³ as the input moves between codes: the error’s distribution leans one way when the input sits just above a code and the other way just below. Under three steps it is flat. The table makes the rule complete.

How far each of the error's first three moments moves with the input, for dithers of 0 to 3 uniform steps. computed by solving, not by drawing; the range over the input of each conditional moment. 0 steps: 0.950, 0.250, 0.216; 1 step: fixed, 0.250, 0.192; 2 steps: fixed, fixed, 0.096; 3 steps: fixed, fixed, fixed. Each added step fixes one more moment and leaves the next free. A dither is a choice of how much of the error's distribution is to stop depending on the signal, paid at a twelfth of a step² for each step.
Fig. 5 How far each of the error’s first three moments moves with the input, for dithers of 0 to 3 uniform steps. With none: 0.950, 0.250 and 0.216. One step fixes the mean and leaves 0.250 and 0.192; two fix the mean and power and leave 0.096; three fix all three.

A dither built from n uniform steps makes the first n moments of the error independent of the signal and leaves the (n + 1)-th free. The reason is that the characteristic function of a box one step wide is zero at every non-zero multiple of the quantiser’s own frequency, and the n-th moment’s dependence on the input is carried by the (n − 1)-th derivative of the dither’s characteristic function at those points; a product of n boxes has zeros of order n there, which kill derivatives up to order n−1n - 1. That is the theorem; the table is it measured.

Each step costs a twelfth of a step² of noise power, because each adds a uniform variable of variance 1/12. So the price schedule is exact and linear in power: one step doubles the noise, two triple it, three quadruple it — 3.01, 4.77 and 6.02 decibels.

Which moments matter

The rule turns the choice of dither into a question about which moments a particular measurement can see. A spectrum analyser looking for harmonics sees the first moment, and one step is enough; when a floor stops being a floor and the dither that is a decision were measurements of that kind. A listener, or an instrument that tracks the noise level against the signal — a power meter, a detector with a threshold — sees the second, and needs two. Very few measurements see the third: it would take a detector whose response to the noise depends on its skewness, and a third step buys protection against that at a further 1.25 decibels.

So the triangular dither is the right default for anything a person listens to or a threshold watches, and one step is the right choice for a measurement that is only ever read through a spectrum. Two steps is not a cautious version of one; it fixes a property one step cannot.

What the price is in a real budget

The prices are easiest to judge against a converter’s own floor. An ideal 16-bit converter driven to full scale has a signal-to-noise ratio of 98.09 decibels — the 6.02N+1.766.02N + 1.76 that six decibels a bit, and the half step blamed on it confirmed to 0.15 dB. Adding one step of dither lowers that to 95.08, two steps to 93.32, three to 92.07. Measured in bits, a triangular dither costs 0.79 of a bit: the converter that was sixteen bits becomes, by noise alone, a little over fifteen.

Whether that is worth paying depends on what the floor is already doing. The floor a converter sets found that past a certain bit count the converter is measuring the thermal noise of whatever drives it, and in that regime the front end’s noise is already a dither several steps wide; adding a triangular dither on top of it costs its full 4.77 decibels of the quantiser’s own contribution, which is by then a small part of the total. Below that bit count the converter’s quantisation is the floor and the dither’s price is paid in full.

The same arithmetic applies wherever a signal is requantised, not only at a converter. A digital filter rounds its products to a word length at every step, and each rounding is a quantiser whose error has the same moments as the converter’s. The word length that is not a threshold measured what a filter’s word length does to its coefficients; the same word length also rounds every product, and that rounding error is undithered unless the designer adds dither inside the arithmetic, and a filter fed a quiet signal can then show exactly the signal-dependent noise and tones the first figure describes. Mastering a recording from 24 bits to 16 is one such requantisation, and it is the reason the triangular dither is standard there: the final word length is the only one a listener ever hears, and its error must not breathe.

A shaped converter adds one more consideration. The loop that is worse at full scale found a noise-shaping loop losing its advantage as its input approaches full scale, because the quantiser inside it overloads; a dither inside such a loop takes up part of the same headroom. The two-step dither that holds the error’s power constant also adds two steps of amplitude at the quantiser’s input, and in a loop running close to its stability limit that is not free.

Subtracting the dither fixes everything

There is a way out of the price schedule altogether, if the dither can be known after conversion. Add a uniform dither of one step before the quantiser, then subtract the same value from the converter’s output — which needs the dither to be generated digitally and converted to an analogue value, or to be a known sequence.

The subtracted error is the quantiser’s error on the dithered input, which is a fraction of a step uniformly distributed for any input, and the subtraction removes the dither itself. The result, measured in the first figure, is an error whose power is a twelfth of a step² at every input — the undithered average, with no price at all — and whose whole distribution is uniform and independent of the signal, not just its first few moments. One step, subtracted, does what no number of added steps can, for 0.00 decibels.

The catch is practical. The dither must reach the converter’s input as an accurate analogue copy of the value that is later subtracted, so the scheme needs a second converter of at least the same accuracy to generate it, and any error in that copy reappears as noise. Subtractive dither is used where the dither can be made accurate cheaply — a known pseudo-random sequence added through a precise digital-to-analogue converter in a measurement system — and rarely elsewhere. It is the limit the added dithers approach as more steps fix more moments, reached in one step by a different arrangement.

The noise shaper’s view of the same rule

Noise shaping, which one bit, and where the noise went and a floor, or five tones measured, feeds the quantiser’s error back so that its spectrum is pushed out of band. The quantiser inside a noise-shaping loop is still a quantiser, and its error’s moments still depend on its input unless something dithers it. A shaping loop with an undithered quantiser produces idle tones — a loop’s version of the locked harmonics — and a loop with one step of dither inside it can still modulate its noise floor with the signal. The two-step rule applies inside the loop as it does outside, with one extra cost: the dither inside the loop is shaped along with the error, so its price falls in the band that matters. That is why shaped converters usually carry a triangular dither inside the loop, and why their in-band noise is lower than the 4.77 decibels the bare price would suggest.

What the measurement leaves out

The quantiser is ideal and uniform: every step is exactly one step wide. A real converter’s steps are unequal, and its error has a component from the step-width errors that depends on which codes the signal uses. Dither spreads the signal over more codes and so averages that component, but the moment rule does not apply to it, because a converter with unequal steps is not the quantiser whose characteristic function the rule is about. Six decibels a bit, and the half step blamed on it measured what an ideal converter’s last code does at full scale; a real one’s whole transfer curve does the equivalent at every code.

The dithers are drawn independently from sample to sample — white. A dither with structure in time, such as a high-passed triangular dither that puts its power where it is least audible, has the same distribution at each sample and so the same moment properties, but its noise spectrum is shaped and its in-band price is lower.

And the signals are noiseless. A real analogue input already carries noise from the circuit in front of the converter, and if that noise is a few steps wide it is itself a dither, usually close to Gaussian; a Gaussian dither fixes no moment exactly but fixes all of them approximately once it is about a step wide, which is why converters with noisy front ends rarely show any of this.

The number to keep

A dither built from n uniform steps makes the first n moments of the quantisation error independent of the signal and leaves the next free: one step fixes the mean and leaves the power at x(1−x)x(1-x) — zero at a code, a quarter of a step² between codes — so the noise breathes with the signal; two steps hold the power at a quarter everywhere and leave the third moment swinging by 0.096 steps³; three fix that. Each step costs a twelfth of a step² — 3.01, 4.77 and 6.02 decibels for one, two and three. One step subtracted after the converter fixes the whole distribution at a twelfth of a step² for nothing.

Still open: the real converter’s unequal steps, a Gaussian front end, and the dither inside the loop

Unequal steps. A converter whose steps differ in width has an error component the moment rule does not reach. How many steps of dither average a given differential nonlinearity down to a given floor, and whether the triangular choice still holds, is a measurement on a converter model with a stated step-width spread.

A Gaussian front end. Circuit noise ahead of the converter is a dither that fixes no moment exactly. Measuring the residual dependence of each moment on the input against the noise’s width would say how much front-end noise makes added dither unnecessary.

The dither inside a shaping loop. Inside a noise-shaping loop the triangular dither is shaped with the error; its in-band price and whether it still holds the in-band noise power independent of the signal are measurable on the loops already built.

Part 5 on quantisation

One argument about Quantisation, and one of 5 essays on it so far, each part numbered by how much of the idea it assumes. What sits either side of it:

What links here

Essays that reach for this one mid-argument — the half of a link its own author cannot write down.

The objects named here

The third axis, after the field and the idea: the things themselves, and every essay that touches each one.

Closed formDesign tradeoffDitherEffective bitsModel rangeNoise floorQuantisationSeeded generatorSignal-to-noise ratioTotal harmonic distortion