Where a signal becomes a number

The staircase on the way out

A converter does not emit impulses. It holds each sample for a whole clock period, which is a convolution with a rectangle and therefore a multiplication by a sinc — 0.14 dB down at a tenth of the sample rate, 0.91 at a quarter, and 3.92 at half, which is exactly 20 log(2/π). Nobody chose that droop and it is nearly eight times the half-decibel ripple of a Chebyshev passband. Measured on the transform of the staircase itself, it agrees with the closed form to 0.008%.

Assumes: The frequency a sample rate invents · Flat magnitude, unflat delay · Three families, one corner

An earlier essay in this field measured the reconstruction the sampling theorem prescribes and found it slow: the error falls only as the first power of the number of terms, so sixteen-bit accuracy would need of order sixty-five thousand terms per output point. Nothing does it.

What every converter does instead is the crudest possible alternative — hold each sample until the next one arrives — and the interesting thing about that choice is that it has a consequence in the frequency domain which nobody selected, cannot be designed away by choosing better components, and is larger than every passband specification this site has written.

The droop a zero-order hold imposes at 48 kHzcomputed by solving, not by drawing. Holding each sample for a clock period convolves the output with a rectangle, so the spectrum is multiplied by a sinc: -0.143 dB down at a tenth of the sample rate, -0.912 at a quarter and -3.922 at half — which is exactly 20 log(2/π) and contains no design decision at all. The dots are the amplitude of the fundamental read out of the transform of the staircase itself, agreeing with the closed form to 0.008%. There is also half a sample of delay, 10.417 µs here, which is the reason a held reconstruction is not a droopy copy of the signal but a droopy copy that has moved.-4-2000.1000.2000.3000.4000.500frequency, as a fraction of the sample rategain (dB)-3.92 dB at half the rate20 kHz is 0.417 of the rate — -2.64 dBthe closed form, sin(x)/xthe staircase, transformedsample rate48 kHzat a tenth of it-0.143 dBat a quarter-0.912 dBat half-3.922 dBat 20 kHz-2.640 dBtwo routes agree to0.008%and it delays by10.417 µssolved, then checked — the rectangle nobody chose-2.64 dB at 20 kHz, -3.92 dB at half
Fig. 1 The droop a zero-order hold imposes. The curve is sin(x)/x; the dots are the amplitude of the fundamental read out of the transform of an actual staircase, sampled at sixty-four points per clock period. The two agree to 0.008%. The slider is the sample rate, which moves the axis and not the shape.

Where the shape comes from

Holding a value for a period T is a convolution in time with a rectangle of width T, so the spectrum is multiplied by that rectangle’s transform, which is

H(f)=Tsin(πfT)πfTejπfTH(f) = T\,\frac{\sin(\pi f T)}{\pi f T}\,e^{-j\pi f T}

Two things are in that expression and both matter.

A magnitude, sin(x)/x. It is one at direct current, falls monotonically to zero at the sample rate, and at half the sample rate takes the value 2/π. In decibels that is 20 log(2/π) = −3.922 dB exactly — a number containing no design decision, no component value and no tolerance. It is imposed by the shape of the output.

A phase, linear in frequency, of half a sample. A delay of T/2, and a constant delay is the one kind of phase this collection’s filters field regards as harmless: it moves the signal in time and does not change its shape. So the hold is a droopy but delay-linear reconstruction, which is more than can be said for most ways of fixing the droop.

Two routes to it

The closed form above is one route. The site’s standing rule is that a closed form gets a second route sharing as little as possible with the first, and here the second route is direct: build the staircase, transform it, and read the amplitude of the fundamental.

heldSpectrum samples a sinusoid at fₛ, holds each sample, and represents the result at sixty-four points per clock period so that the steps are drawn rather than assumed. The transform then reports the fundamental’s amplitude, which is compared with sin(x)/x.

f/f closed form measured apart
0.05 0.99589 0.99589 0.000%
0.10 0.98363 0.98364 0.000%
0.20 0.93549 0.93550 0.002%
0.30 0.85839 0.85842 0.004%
0.40 0.75683 0.75688 0.006%
0.45 0.69865 0.69870 0.008%

Worst 0.008% across the six measurements the gate takes at two sample rates, which is the sampling of the staircase rather than either expression.

Getting that agreement required the frequency to be derived rather than chosen, and the failure that forced it is worth recording. A first version took a frequency and a cycle count and rounded the clock count to fit, which meant the record held a whole number of signal periods and a fractional number of clock periods. The staircase was then not periodic over the record, the transform leaked, and the two routes disagreed by 5.1% at a frequency where the closed form is exact — small enough to look like a discretisation error and large enough to look real.

The repair is to state two integers and derive the frequency from them: cycles signal periods and clocks clock periods in one record, so f = cycles × fₛ / clocks. Both periodicities are then exact by construction. This is the same class of error the noise field found twice when its two routes disagreed by two to seven per cent, and the same class of repair: fix the discretisation, do not widen the tolerance.

What the reconstruction returns, either side of 5.0 kHz. computed by solving, not by drawing. The Whittaker–Shannon sum is evaluated on the samples and compared with two things: the signal that was sampled, and the frequency the samples report. Below 5.00 kHz these are the same curve and the error is 4.88e-3 — the truncation of the sum at sixty-four samples either side, and nothing else. Above it they part: at 3.00 kHz the reconstruction is 6.74e-3 from the alias and 0.007 from the input. The small number is the interesting one. A reconstruction cannot be improved into the right answer, because it is already an exact answer to a different question.
Fig. 2 The reconstruction this one is the crude alternative to. The ideal sum converges as the first power of the number of terms, so sixteen-bit accuracy needs sixty-five thousand terms per output point — which is why every converter holds instead, and why the droop above is a specification rather than an implementation detail.

The one frequency where the measurement cannot be made

The table stops at 0.45 rather than at 0.5, and the reason is not a tolerance.

A sinusoid at exactly half the sample rate, sampled from t = 0, is sampled at sin(πk) — which is zero at every instant. The staircase is flat, its transform is empty, and the measured droop comes out as zero against a closed form that is perfectly well defined there. The gate holds that case rather than avoiding it, asserting that the measured value is below 10⁻¹² and recording that it is a true statement about sampling at the Nyquist frequency and not a defect in either route.

That is worth a paragraph because it is a small instance of the field’s opening argument. At exactly half the rate a sinusoid and its own image coincide, and what they coincide at depends on the phase: starting at t = 0 gives all zeros, starting a quarter cycle later gives an alternating sequence at full amplitude. Neither is more correct. The boundary is the frequency at which the samples stop determining the amplitude, and this is what that looks like from the inside.

What the droop is, next to what this site normally worries about

The number worth carrying away is a comparison rather than a value.

specification value
the hold, at half the sample rate 3.922 dB
the hold, at a quarter 0.912 dB
a Chebyshev passband ripple, as designed here 0.5 dB
a Butterworth’s departure at a tenth of its corner under 0.01 dB
the hold, at a tenth of the sample rate 0.143 dB

A designer who would not accept half a decibel of Chebyshev ripple in the passband accepts three-point-nine decibels of hold droop at the top of the band, usually without noticing, because it is not written in any specification the filter carries. It arrives from the shape of the output stage rather than from a component.

At the ordinary audio ratios the number is smaller and still not negligible. A 20 kHz band at a 48 kHz sample rate reaches 0.417 of the rate, where the droop is 0.81 dB — larger than the ripple of every filter in this site’s filters field.

The droop a zero-order hold imposes at 8 kHz. computed by solving, not by drawing. Holding each sample for a clock period convolves the output with a rectangle, so the spectrum is multiplied by a sinc: -0.143 dB down at a tenth of the sample rate, -0.912 at a quarter and -3.922 at half — which is exactly 20 log(2/π) and contains no design decision at all. The dots are the amplitude of the fundamental read out of the transform of the staircase itself, agreeing with the closed form to 0.008%. There is also half a sample of delay, 62.500 µs here, which is the reason a held reconstruction is not a droopy copy of the signal but a droopy copy that has moved.
Fig. 3 Eight kilohertz. A twenty-kilohertz input folds to 4.00 kHz, the hold is 3.92 dB down at half the rate, and the delay it adds is 62.500 µs. What the droop is, next to what this site normally worries about, is a fixed shape: −3.92 dB at half the sample rate whatever the rate, because the hold is a rectangle one sample long and its transform is a sinc.
The droop a zero-order hold imposes at 16 kHz. computed by solving, not by drawing. Holding each sample for a clock period convolves the output with a rectangle, so the spectrum is multiplied by a sinc: -0.143 dB down at a tenth of the sample rate, -0.912 at a quarter and -3.922 at half — which is exactly 20 log(2/π) and contains no design decision at all. The dots are the amplitude of the fundamental read out of the transform of the staircase itself, agreeing with the closed form to 0.008%. There is also half a sample of delay, 31.250 µs here, which is the reason a held reconstruction is not a droopy copy of the signal but a droopy copy that has moved.
Fig. 4 Sixteen kilohertz: the same fold to 4.00 kHz, the same −3.92 dB at half, and 31.250 µs of delay. The delay is exactly half a sample at every rate — which is the one part of a zero-order hold that is not a distortion at all, and is the part most often left out of a latency budget.

The three ways out, and what each costs

The droop is fixed by the sample rate and the band, so the ways of dealing with it are the ways of changing one of those or of undoing the shape.

Oversample. At four times the rate the top of the band is at an eighth of fₛ, where the droop is 0.22 dB rather than 0.81. This is the usual answer in audio and it costs exactly what the noise-shaping essay says a fast clock costs, which is often already being paid for other reasons.

Compensate digitally. A filter before the converter whose passband rises to meet the droop it cannot see. Cheap in a system that already has arithmetic, and precise, since the shape is known exactly and has no tolerance in it. The complication is that its correction is only right for the sample rate it was computed at.

Compensate in the analogue reconstruction filter. The filter after the converter is there anyway to remove the images, so its passband can be shaped to rise. This is where the correction interacts with the site’s own filters field in an interesting way: a passband deliberately not flat is one whose group delay is not what a family’s tables say either, and the all-pass equaliser essay has already measured what flattening a delay costs — the correction adds 722 µs at direct current to remove 392 µs of variation, because an all-pass can only add.

None of the three removes the half-sample delay, and none of them needs to. A constant delay is not a distortion, and this collection has been careful about that distinction since the filters field: flat magnitude does not mean flat delay, and a delay that is the same at every frequency changes nothing about a waveform’s shape.

The droop a zero-order hold imposes at 96 kHz. computed by solving, not by drawing. Holding each sample for a clock period convolves the output with a rectangle, so the spectrum is multiplied by a sinc: -0.143 dB down at a tenth of the sample rate, -0.912 at a quarter and -3.922 at half — which is exactly 20 log(2/π) and contains no design decision at all. The dots are the amplitude of the fundamental read out of the transform of the staircase itself, agreeing with the closed form to 0.008%. There is also half a sample of delay, 5.208 µs here, which is the reason a held reconstruction is not a droopy copy of the signal but a droopy copy that has moved.
Fig. 5 Ninety-six kilohertz. Twenty kilohertz now sits at 0.208 of the rate and is only 0.63 dB down. The three ways out are to oversample until the droop is negligible — this figure — to correct it digitally with an inverse-sinc filter, or to correct it in the analogue reconstruction filter; the first costs conversion rate, the second costs coefficients, and the third costs a filter that is no longer simple.

What the hold is, as an element

This site’s habit is that everything is a netlist, and it is worth saying where the hold sits in that scheme, because it is the one object in this field that genuinely is a circuit and is easy to treat as arithmetic.

A hold is a switch and a capacitor. The switch closes for a moment, the capacitor charges to the sample value, the switch opens, and the capacitor holds the value until the next moment. Everything this collection has already measured about switches and capacitors applies to it:

The capacitor is not ideal. It has the equivalent series resistance and lead inductance the real-capacitor essay measures, which set an upper frequency at which it stops being a capacitor at all — 4.69 MHz for 100 nF with 1.2 nH of lead. A hold running at 5 MHz is asking a capacitor to behave like one at a frequency where it does not.

The switch has a resistance, so the acquisition is an RC settling and needs several time constants of the clock period to reach the sample’s accuracy — which for sixteen bits is eleven time constants, and is the reason a fast converter’s front end is a hard analogue problem rather than a digital one.

Whatever follows loads it. The divider essay’s arithmetic applies unchanged: a hold capacitor discharging into a finite input resistance droops during the hold, and one per cent of accuracy needs a load about 49.5 times the source — which here becomes a requirement on the time constant against the clock period.

None of these is drawn in this essay’s figures, and the reason is that each is a figure the site already has, in a field that owns it. What this essay adds is the one consequence of the hold that none of those fields contains: the sinc, which is a property of the shape of the output in time and belongs to neither the capacitor nor the switch.

What the staircase looks like in time, which is a different essay

The transients field already draws a staircase, for a different reason and with a different lesson — the trapezoidal rule marching a network forward and the staircase it produces in time. It is worth naming the difference, because the two figures look alike and are about opposite things.

There the staircase is an artefact of the computation: a numerical integrator’s finite step, whose error falls by a factor of 4.00 for every halving and which converges to a smooth answer that exists independently of it.

Here the staircase is the signal. There is no smoother thing it is converging to; the converter’s output really is piecewise constant, and everything downstream — the reconstruction filter, the amplifier, the load — receives a waveform with steps in it and a spectrum with images in it.

That distinction is the whole reason the droop is a specification rather than a numerical detail. An integration step can be halved until the artefact goes away. A clock period cannot be halved until the steps go away, because the steps are what a converter emits.

The images, which are the other half of what the hold does

The droop is what the hold does to the wanted band. What it does above the wanted band is the reason a reconstruction filter exists at all, and it follows from the same expression.

A sampled signal’s spectrum repeats around every multiple of the clock — that is the sampling identity of this field’s first essay, seen from the frequency side. The hold multiplies all of those copies by the same sinc, and the sinc has zeros at every multiple of fₛ. So each image is attenuated, but only at its centre: an image band spanning fₛ ± B is attenuated by the sinc evaluated across that span, which for a 20 kHz band at 48 kHz gives 5.56 dB at the near edge — 28 kHz — and 13.27 dB at the far edge, 68 kHz.

Five and a half decibels is not a filter. It is a small head start, and its shape is the wrong way round: the near edge of the first image, which is the one a reconstruction filter has the least room to deal with, is also the one the sinc attenuates least.

The arithmetic is worth doing once, because it sets the requirement the way the anti-alias essay set its own. To hold the first image 80 dB below the wanted band, the reconstruction filter must supply 80 − 5.56 = 74.4 dB by fₛ − B, which for a 20 kHz band at 48 kHz is 28 kHz — a skirt of 74 dB in 0.15 of a decade. That is the same shape of requirement the anti-alias essay priced in clock rate, and it produces the same answer: at 48 kHz it is not achievable with a gentle family, and oversampling by four moves it from impossible to routine.

So the hold’s two consequences point the same way. The droop wants a higher sample rate to keep the band clear of the sinc’s fall; the images want a higher sample rate to move them away from the band edge. Both are arguments for oversampling that have nothing to do with quantisation noise, and a system designed around a fast converter is usually being paid three times over for one decision.

One number that is not the droop, and is usually reported as it

A converter’s output stage has a second imperfection that lands in the same place on a measurement and has a different cause, and separating them is the same exercise this field has done twice already.

Between one sample and the next the output has to move, and it moves at a finite rate. A converter switching from one code to another produces a transition of finite duration, and if the transitions in one direction differ from those in the other — which they do, because the switches are not identical — the average of the output over a clock period depends on which way it moved. That is a signal-dependent error, so it appears as harmonic distortion rather than as a droop.

The transients field has already put a number on the general form of it. A unity-gain follower with 0.5 V/µs of slew rate stops being linear above a 79.6 mV step, which is far below anything anybody calls large signal, and the boundary is an amplitude rather than a frequency. A converter’s output stage has the same boundary, met once per sample, and at high sample rates it is met on every transition rather than occasionally.

The two effects separate cleanly on a measurement because one is a smooth magnitude error and the other is a harmonic. The droop is 0.81 dB at the top of a 20 kHz band at 48 kHz and contains no harmonics whatever, being a linear filter; the transition asymmetry produces harmonics and hardly touches the fundamental. So a measurement that reports “the output is 0.8 dB down at 20 kHz and has 0.02% distortion” is reporting two mechanisms, and only the first of them is in this essay.

The droop a zero-order hold imposes at 192 kHz. computed by solving, not by drawing. Holding each sample for a clock period convolves the output with a rectangle, so the spectrum is multiplied by a sinc: -0.143 dB down at a tenth of the sample rate, -0.912 at a quarter and -3.922 at half — which is exactly 20 log(2/π) and contains no design decision at all. The dots are the amplitude of the fundamental read out of the transform of the staircase itself, agreeing with the closed form to 0.008%. There is also half a sample of delay, 2.604 µs here, which is the reason a held reconstruction is not a droopy copy of the signal but a droopy copy that has moved.
Fig. 6 A hundred and ninety-two kilohertz: 0.104 of the rate, 0.16 dB down, 2.604 µs of delay. One number that is not the droop and is usually reported as it is the −3.92 dB at half the sample rate: that figure is at the Nyquist frequency, where no signal is supposed to be, and quoting it as the converter’s response is quoting the worst point of a curve nothing is meant to reach.

This is the field’s fourth instance of the same instruction, and it is the one the whole collection is built on: when two mechanisms land on one measurement, measure them separately before explaining either. The droop has a closed form and is checked against a staircase; the transitions have an amplitude boundary and are checked against a slew rate; and the number a bench reports is their sum, which is not a measurement of either.

The sharpest version of that instruction on this site is one field over, and it is worth the comparison because there the two mechanisms were a factor of fourteen apart and both accounts were in print. Which picture sets the upper edge finds every reference naming the same mechanism for a transformer’s high-frequency limit — leakage inductance resonating with winding capacitance — and measures the resonance at 1.13 MHz against an actual edge at 81.3 kHz, because what binds at that load is the leakage in series with the load, a first-order corner with no resonance in it at all. The two swap at about 1500 Ω, and both accounts are current because both are sometimes right.

A converter’s output has the same structure and has not had the same argument, because one of its two mechanisms is exactly calculable and the other is a property of a part. The droop is 20log(2/π)20\log(2/\pi) at half the sample rate whatever anybody builds; the transition distortion depends on the output stage. So the useful habit here is not to decide which mechanism wins but to subtract the one that is known — which is what the closed form makes possible, and what a measurement quoting a single amplitude flatness figure has already made impossible.

Part 1 on reconstruction

One argument about Reconstruction, and one of 4 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 8 sharing most with it of 11.

What this makes readable

Essays that name this one as a prerequisite.

The objects named here

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

Group delayPhase linearityReconstructionSample rateZero-order hold