Where a signal becomes a number

Four rectangles and no filter

A converter's output pulse can be any number of one-clock rectangles convolved together: one is the hold, two the straight line, four the cubic B-spline. Measured on its own waveform, n rectangles give the hold's sinc to the n-th power to a few parts in ten million, so each one rejects the nearest image by exactly what one analogue pole could at best — and each saves exactly one pole of reconstruction filter until none is left. At the Nyquist rate that is three poles of nineteen and a half, bought with 10.56 dB of droop. From about 2.8 times oversampling the cubic pulse needs no analogue filter at all for 60 dB, for 0.62 dB of droop at four times and two clocks of delay. The cost is that from three rectangles on the output no longer passes through its samples.

Assumes: The staircase on the way out · The frequency a sample rate invents

The pole a straight line is worth replaced the converter’s held staircase with straight lines between the samples. A straight line is a triangle two clocks wide, which is a one-clock rectangle convolved with itself, so its transform is the hold’s sinc squared: every decibel of droop and every decibel of image rejection doubled. The part of that result worth carrying was exact. Because sin⁡πx=sin⁡π(1−x)\sin \pi x = \sin \pi (1 - x), the second sinc rejects the nearest image, relative to the signal, by exactly 20log⁡(fimage/fband)20 \log(f_{image}/f_{band}) — which is the most a single analogue pole can ever do there, reached only as its corner goes to zero. The straight line is worth exactly one pole of reconstruction filter at every oversampling ratio, and it pays with a whole clock of delay against the hold’s half.

That essay ended by asking about the next pulse. A rectangle convolved with itself three times is a smooth bell four clocks wide, the cubic B-spline, and by the same argument it should be the sinc to the fourth power and worth three poles over the hold. This essay measures that, asks where the law stops, and finds the point on the oversampling axis at which a long enough pulse leaves no analogue filter to build.

One power of the sinc per rectangle

A pulse of nn rectangles is the unit rectangle convolved with itself n−1n - 1 times: one is the hold of the staircase on the way out, two the triangle, three a piecewise quadratic three clocks wide, four a piecewise cubic four clocks wide. Each sample launches one such pulse at its own clock edge, and the output is their sum. Convolution in time is multiplication in frequency, so the output’s spectrum should be the sampled spectrum times the sinc to the nn-th power.

4 rectangles: the hold's sinc to the power 4, 10.56 dB of droop and the first image 11.7 dB downcomputed by solving, not by drawing. A 20 kHz tone on a 48 kHz clock, reconstructed by a pulse of 4 rectangles convolved together — the hold, the straight line, the quadratic and the cubic B-spline for one to four — with the envelopes of all four drawn and the lines of the 4-rectangle waveform read from its own transform (stems). They agree with the sinc to the 4th power to 0.000 per cent. Droop 10.560 dB; the nearest image 11.69 dB below the signal, 4 times the hold's 2.92. The nulls stay on the multiples of the clock; each rectangle deepens everything else.-100-75-50-25000.50011.5022.503frequency, as a multiple of the sample rateamplitude (dB, full scale)1 rectanglesinc, delay 0.5 clock2 rectanglessinc^2, delay 1 clock3 rectanglessinc^3, delay 1.5 clock4 rectanglessinc^4, delay 2 clockdrawn: droop10.560 dB…first image−11.69 dBsolved, then checked — the waveform transformed, not the formulaone power per rectangle
Fig. 1 A 20 kHz tone on a 48 kHz clock reconstructed by a four-rectangle pulse, with the envelopes of one to four rectangles drawn and each line of the four-rectangle waveform read from its own transform. They agree with the sinc to the fourth power to a few parts in ten million. Droop 10.56 dB; the nearest image 11.69 dB below the signal, four times the hold’s 2.92.

Built sample by sample as a converter would build it and transformed, the four-rectangle waveform’s lines agree with the fourth power of the sinc to a few parts in ten million — closer than the hold and the straight line agreed with their own closed forms, because a smoother waveform has harmonics that fall faster and fold back less in the finite record. For one and two rectangles the same construction reproduces the staircase and the straight lines of the earlier essays sample for sample, so the three routes are one route checked three times.

The numbers at 20 kHz on a 48 kHz clock follow the law exactly. The hold droops 2.64 dB at the band edge and rejects the nearest image, 28 kHz, by 2.92 dB relative to the signal. Four rectangles droop 10.56 dB and reject it by 11.69: four times each, in decibels. The nulls stay on the multiples of the clock, because every factor of the product is zero there — the nulls the nulls are where nothing is found no image ever sits on — and every other point on the curve deepens. The slider on the figure at the head of the page steps through one to four.

Half a clock for each

The price the magnitude does not show is time.

Each rectangle adds half a clock of delay, and from three on the output no longer passes through the samples. computed by solving, not by drawing. A 4 kHz tone sampled at 48 kHz (dots) and reconstructed by pulses of one to four rectangles. Each output's fundamental lags the input by 0.500, 1.000, 1.500, 2.000 clocks — n/2 for n rectangles — read from its phase. The hold and the straight line pass through every sample, late; the quadratic and cubic pulses do not: two clocks after a sample, the cubic's output is (s₋₁ + 4s₀ + s₁)/6, a three-point average. That smoothing is the droop, and it is correctable digitally because it is a fixed filter on the samples.
Fig. 2 A 4 kHz tone sampled at 48 kHz (dots), reconstructed by pulses of one to four rectangles. Each output’s fundamental lags the input by 0.500, 1.000, 1.500 and 2.000 clocks. The hold and the straight line pass through every sample, late; the quadratic and cubic do not — two clocks after a sample, the cubic puts (s−1+4s0+s1)/6(s_{-1} + 4s_0 + s_1)/6 there.

A pulse of nn rectangles is symmetric about its middle, n/2n/2 clocks after it starts, and a causal converter cannot start it before its sample arrives. So the output lags by n/2n/2 clocks, and the figure reads exactly that from the phase of each fundamental: 0.500, 1.000, 1.500 and 2.000 clocks.

The figure also shows the second price, and it is new with the third rectangle. The hold and the straight line are interpolators: at the right instant each reproduces its sample exactly, late. The quadratic and cubic pulses are not. A cubic B-spline is nonzero over four clocks, so at any instant three samples contribute; two clocks after sample s0s_0 was taken the output is (s−1+4s0+s1)/6(s_{-1} + 4 s_0 + s_{1})/6, a weighted average, which the figure confirms to rounding. That averaging is the extra droop seen in the spectrum. It is a fixed filter on the sample sequence, which makes it correctable exactly in the digital domain before the converter — the pre-emphasis flatness, and the two currencies it is bought in priced for the hold, at a cost in headroom rather than in signal-to-noise ratio. The correction for a pulse of nn rectangles has to undo nn times the hold’s droop, so the headroom it costs grows with the pulse.

Exactly one pole each

The straight line’s one-pole identity generalises without change. Each rectangle multiplies the image’s level relative to the signal by sinc(x)/sinc(1−x)=(1−x)/x\mathrm{sinc}(x)/\mathrm{sinc}(1-x) = (1-x)/x, which is exactly the image’s distance from the band edge. That is a pole’s worth at that distance, so a pulse of nn rectangles is worth exactly n−1n - 1 poles over the hold, at every oversampling ratio.

Each rectangle saves exactly one pole, and four rectangles leave no filter to build from 2.83× up. computed by solving, not by drawing. The order of maximally flat analogue filter still needed for 60 dB at the nearest image of a 20 kHz band, after the pulse's own rejection, against the oversampling ratio of a 48 kHz base clock, for pulses of one to four rectangles. Since a rectangle's rejection of the nearest image, relative to the signal, is exactly 20·log of the image's frequency over the band edge's — one pole's worth at that distance — the curves are the hold's shifted down by one pole each, and meet zero in turn: at the Nyquist rate the hold needs 19.5 poles and four rectangles 16.5; four rectangles need none from 2.83 times up, and the hold none until beyond 64 times.
Fig. 3 The order of maximally flat analogue filter still needed for 60 dB at the nearest image of a 20 kHz band, after the pulse’s own rejection, against the oversampling ratio of a 48 kHz base clock, for pulses of one to four rectangles. The curves are the hold’s shifted down one pole at a time. At the Nyquist rate the hold needs 19.5 poles and four rectangles 16.5; four rectangles need none from about 2.8 times up.

The figure uses the same rule as one knob, and the two exponents it turns: a maximally flat filter gains 20log⁡(fimage/fband)20 \log(f_{image}/f_{band}) of rejection per pole at the nearest image, and the pulse’s own rejection is subtracted from the sixty decibels wanted before the filter is sized. Each curve is the hold’s moved down by exactly one pole for each rectangle, and the check is exact, to the ninth decimal, at every one of twenty-five ratios. The law holds until a curve reaches zero. Once a pulse rejects the image by sixty decibels on its own there is no filter left to shorten, and another rectangle buys nothing but droop and delay.

At the Nyquist rate this is not much use, for the reason what the filter in front costs met on the input side, where the clock a filter family demands turned out to be the whole of its price: close to the Nyquist rate every decibel of separation is expensive. The image is only 1.4 times the band edge away, a pole is worth 2.92 dB there, and the hold needs a filter of 19.5 poles. Four rectangles bring that to 16.5. Three poles of nineteen is a small saving, bought with the next section’s bill.

Smoothness, read in the time domain

The one-pole-per-rectangle law has a reading in the waveform that makes it less of a coincidence. A held staircase jumps at every clock edge, and a waveform with jumps has harmonics that fall as the first power of frequency, twenty decibels a decade — which is the sinc’s envelope. A straight-line waveform is continuous but has a corner at every sample, and a waveform whose first derivative jumps has harmonics falling as the square of frequency, forty decibels a decade. The quadratic pulse’s output has a continuous slope and a jump in its curvature, sixty decibels a decade; the cubic’s is continuous through its second derivative, eighty.

So each rectangle adds one continuous derivative to the output and twenty decibels a decade to the fall of its far images, and twenty decibels a decade is what one pole contributes to a filter’s asymptote. The identity at the nearest image and the slope at the far ones are the same fact about smoothness, measured at two distances. It is also why the four-rectangle record agreed with its closed form a thousand times more closely than the staircase did: the finite record folds back whatever lies above its own resolution, and a smoother waveform has less there to fold.

The practical form of the statement is about the converter’s analogue output stage. An output that jumps asks the stage for an unbounded slew rate at every edge and gets a glitch; an output with a continuous slope asks for a bounded one. The longer pulse is kinder to whatever follows the converter as well as quieter in its images, and that is a separate reason, not captured by any of the counts here, to prefer it once the droop is small.

What each rectangle costs

The droop grows with the pulse and falls with the ratio, and the ratio is where the whole trade is decided.

The price of a rectangle: its share of the droop, 2.64 dB at the Nyquist rate and 0.156 at four times it, and half a clock. computed by solving, not by drawing. The droop at the 20 kHz band edge against the oversampling ratio of a 48 kHz base clock, for pulses of one to four rectangles: n times the hold's, falling as the square of the ratio. At the Nyquist rate four rectangles droop 10.56 dB, which no correction should be asked to undo; at four times it 0.622 dB, and at sixteen 0.0388. The delay is n/2 clocks of whatever clock is running: two clocks for four rectangles is 41.7 µs at 48 kHz and 10.42 µs at 192.
Fig. 4 Droop at the 20 kHz band edge against the oversampling ratio of a 48 kHz clock, for pulses of one to four rectangles: n times the hold’s, falling as the square of the ratio. Four rectangles droop 10.56 dB at the Nyquist rate, 0.622 dB at four times it and 0.0388 at sixteen. Two clocks of delay is 41.7 µs at 48 kHz and 10.42 µs at 192.

Every rectangle costs one hold’s droop, 2.64 dB at the Nyquist rate, so the cubic pulse there droops 10.56 dB at the band edge — a correction that would have to lift the top of the band by a factor of 3.4 in amplitude, spending that much headroom. At four times oversampling the hold’s droop is 0.156 dB and four rectangles cost 0.622 dB, a correction nobody would notice. At sixteen times four rectangles droop 0.0388 dB, which is already below what most specifications care about uncorrected.

The delay is two clocks of whatever clock is running. At 48 kHz that is 41.7 µs; at 192 kHz, 10.42 µs. So the two costs of a long pulse fall with oversampling at different rates — the droop as the square of the ratio, the delay as its first power — which is the same pair of exponents one knob, and the two exponents it turns found for the hold alone, applied to a pulse nn times as long.

The pulse that replaces the filter

Setting the two figures beside each other asks a sharper question than whether a longer pulse helps. At each ratio, what is the fewest rectangles that need no analogue filter at all, and what does that pulse cost?

The pulse that replaces the filter: 21 rectangles at the Nyquist rate, 4 at four times it, 2 at sixteen. computed by solving, not by drawing. For each oversampling ratio of a 48 kHz base clock, the fewest rectangles in the output pulse that put the nearest image of a 20 kHz band 60 dB below the signal with no analogue filter at all (numbers on the points), and the droop that pulse costs at the band edge. At the Nyquist rate it is 21 rectangles and 55.4 dB; at twice it 6 and 3.78 dB; at three and four times, 4 rectangles — the cubic pulse — for 1.11 and 0.62 dB; from sixteen times up, 2, the straight line. The count falls as the image moves out, and the droop of the pulse that does the whole job falls faster.
Fig. 5 For each oversampling ratio, the fewest rectangles that put the nearest image of a 20 kHz band 60 dB below the signal with no analogue filter (numbers on the points), and that pulse’s droop at the band edge. 21 rectangles and 55.4 dB at the Nyquist rate; 6 and 3.78 dB at twice it; 4, the cubic, for 1.11 and 0.62 dB at three and four times; 2, the straight line, from sixteen times up.

The count is the ceiling of sixty decibels over what one rectangle rejects, and it falls fast as the image moves out. At the Nyquist rate it is 21 rectangles drooping 55.4 dB, which is a description of why nobody reconstructs at the Nyquist rate without a filter. At twice the rate it is six, drooping 3.78 dB. At three and four times it is four — the cubic pulse — drooping 1.11 and 0.62 dB. From six times up three rectangles suffice, and from sixteen times up the straight line alone does it.

So the answer to the question the straight-line essay left is that a longer pulse stops paying at a definite point, and the point is set by the target rather than by the pulse: once nn reaches ⌈60/(20log⁡(fimage/fband))⌉\lceil 60/(20 \log(f_{image}/f_{band})) \rceil the filter is gone, and every rectangle past that is droop and delay with nothing bought. And the pulse that does the whole job gets cheap quickly. The cubic at four times oversampling, 192 kHz for a 20 kHz band, replaces a reconstruction filter entirely for two clocks — 10.4 µs — and a correction of six tenths of a decibel.

The figure counts only the nearest image, and the claim needs one check more. The next images out, either side of twice the clock, sit about twice as far from the band as the nearest does, and each rectangle rejects an image by its own distance ratio in decibels, so a pulse that clears the nearest image by sixty decibels clears the rest by more. The nulls at the clock’s multiples help further; they are exact zeros of every factor.

A worked converter

Take the ordinary case, a 20 kHz audio band reconstructed at 192 kHz, four times a 48 kHz base rate, with sixty decibels wanted at the nearest image, 172 kHz. One rectangle rejects that image by 18.7 dB relative to the signal, and a maximally flat filter gains 18.7 dB a pole there.

Held, the output needs 2.2 poles of analogue filter: a third-order filter, placed to droop as little as possible in the band, plus the hold’s own 0.156 dB, half a clock of delay, 2.6 µs. Joined by straight lines, it needs 1.2 poles, which is a second-order filter, and droops 0.311 dB with a clock of delay, 5.2 µs. The quadratic pulse needs 0.2 of a pole — in practice a single gentle pole well above the band, or nothing if the last two decibels can be found elsewhere — and droops 0.467 dB with 7.8 µs of delay. The cubic needs nothing at all and droops 0.622 dB with 10.4 µs of delay.

So at this rate the whole analogue reconstruction filter is exchanged, pole for rectangle, for six tenths of a decibel of digital correction and eight microseconds. For a playback path that is an easy trade. For a converter inside a control loop, where eight microseconds is phase rather than latency, it is not obviously one, and that is the next question.

What a designer should take

A converter’s pulse length is a filter parameter in its own right, worth exactly one pole of reconstruction filter per rectangle and costing one hold’s droop and half a clock of delay per rectangle. At low oversampling it is a poor trade, since the droop is large and the poles saved are a small fraction of a large filter. From about three times oversampling it is the best trade available: the cubic pulse removes the analogue filter entirely for 60 dB, with a fixed digital pre-emphasis for the droop.

Two conditions come with that. The pulse must actually be emitted as a smooth waveform, which means an interpolating filter running at a much higher rate in front of a converter that holds for a short time — the analogue output is the B-spline only if the converter’s own hold is short against the pulse. And from three rectangles on the output is a smoothed version of the samples rather than the samples, so anything that depends on the output passing through each sample — a waveform generator that promises its sample values at its sample instants — has to apply the inverse filter first.

In a control loop, the delay is the bill that matters, and half a clock against a pole prices it at a loop’s crossover.

How the numbers were obtained

Each pulse is the cardinal B-spline of nn rectangles, evaluated by the truncated-power formula 1(n−1)!∑j(−1)j(nj)(x−j)+n−1\frac{1}{(n-1)!}\sum_j (-1)^j \binom{n}{j} (x-j)_+^{n-1}, and each output record is the sum of the pulses launched by twelve clocks’ samples of a tone at five-twelfths of the clock, at 256 points per clock over a whole number of periods of both, so every line is a bin centre and no window is needed. The one- and two-rectangle records are compared point for point with the hold’s staircase and the straight lines of the earlier essays and differ by nothing and by 2×10−162 \times 10^{-16}. The delays are read from the phase of each fundamental over twelve clocks at twelve thousand points. The pole counts, droops and filterless counts are the identities stated, evaluated at twenty-five ratios spaced a quarter of an octave apart.

What it leaves out

The converter’s own hold. A real digital-to-analogue converter holds each of its own samples for its own clock period, so an interpolator running at kk times the rate in front of it emits a staircase approximation to the B-spline with kk steps per clock. That adds one more sinc, at the fast clock, which is small in the band and puts its own images at multiples of the fast clock where the B-spline’s images are already deep.

The interpolating cubics. The cubic most often used in resampling is not the B-spline. A Keys or Catmull–Rom cubic passes through its samples, so it needs no correction, and its transform is not a power of the sinc: it rejects the nearest image less and droops less. Whether an interpolating cubic is worth a pole, a fraction of one or more than one is a different measurement on the same apparatus.

Every image but the nearest. The argument above says the further images are rejected more, and the transforms show it. It is not a claim about a signal whose band reaches close to half the clock, where the second image comes nearer.

Still open: the interpolating cubic, the correction’s own length, and the pulse in a loop

The interpolating cubic. Keys’s cubic kernel passes through the samples and has a transform that is not a sinc power. Its rejection of the nearest image, measured on its own waveform, would say whether the requirement that the output pass through its samples costs a pole, and how much of one.

The pre-emphasis for a long pulse. Undoing nn times the hold’s droop needs a digital filter whose gain at the band edge is that large; its length for a tenth of a decibel of accuracy, and the images it lifts in doing so, would complete the bill for the filterless cubic at three and four times oversampling.

The pulse inside a loop. Every rectangle is half a clock of delay, and in a digitally controlled loop that is phase at the crossover rather than latency. Half a clock against a pole takes the straight line into a loop; the cubic’s two clocks would be the harder case.

Part 6 on reconstruction

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

Joining the samples with straight lines squares the hold's sinc: 5.28 dB of droop and 5.8 dB of image rejection, both doubled. computed by solving, not by drawing. A 20 kHz tone on a 48 kHz clock, reconstructed two ways: held for a whole clock period (dashed envelope, open stems) and joined sample to sample by straight lines (solid envelope, filled stems). Every line is read from a transform of that waveform itself. The held one comes out 2.640 dB down and its nearest image 2.92 dB below it; the interpolated one 5.280 dB down with the image 5.85 dB below. A straight line between samples is a triangle two clocks wide, which is a rectangle convolved with itself, so its transform is the sinc squared: every decibel doubles and the nulls stay where they were. The pole a straight line is worth Part 5 — A converter that joins its samples with straight lines instead of holding each one is convolving with a triangle rather than a rectangle, and its transform is the hold's sinc squared. Every decibel doubles: 5.28 dB of droop at a 20 kHz band edge on a 48 kHz clock instead of 2.64, and 5.85 dB of image rejection instead of 2.92. Both exponents of the oversampling ratio are unchanged. The second sinc is worth exactly one pole of reconstruction filter at every ratio, because a sinc's rejection of the nearest image is twenty times the log of that image's distance from the band edge, identically. A single analogue pole allowed the same droop gives a fraction of that rejection. The price is a whole clock of delay rather than half. With the crossover at 10% of the clock the straight line overshoots 13.7%, the hold with its pole 32.8%. computed by solving, not by drawing, marched at 160 steps a clock. A unit step through a loop whose plant is an integrator crossing over at 10% of the sample rate, reconstructed three ways: held (dotted), joined by straight lines (solid), and held then passed through the analogue pole that attenuates the nearest image, at 90% of the clock, exactly as much as the straight line's second sinc does (dashed) — a pole at 9.90% of the clock, at the crossover itself. Overshoot: 0.0%, 13.7% and 32.8%. The straight line buys the same image rejection for half a clock of delay; the pole buys it for forty-five degrees. Half a clock against a pole Part 7 — Inside a digitally controlled loop a converter's delay is phase at the crossover, and a straight-line output pays one more half clock than a hold: 180 degrees times the crossover over the clock. The analogue pole that rejects the nearest image as much as the straight line's second sinc does turns out to sit at the crossover itself — 0.990 of it when the loop crosses over at a tenth of its clock, sinc(r) of it in general — so it costs forty-five degrees however slow the loop is. By the phase estimate the half clock is the cheaper filter below 26% of the clock. Marched as a sampled loop the answer is 17.6%, and at a tenth of the clock a step overshoots 13.7% through the straight line against 32.8% through the hold and its pole, for the same image rejection measured on both waveforms.

The objects named here

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

Anti imaging filterDesign tradeoffFilter orderGroup delayOversamplingReconstructionZero-order hold