Where a signal becomes a number

The loop that is worse at full scale

A second integrator in a one-bit loop takes the shaping law from nine decibels an octave to fourteen, and a third to nineteen. What it charges is not in decibels at all: past six tenths of full scale the ratio starts falling, and a fourth integrator's states run away at seven tenths. The best input to a second-order modulator is 0.6 of the reference it is measured against — an amplitude boundary of exactly the kind this collection is built for, on the one object in the field that has no continuous output to draw.

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

The rung below this one put a one-bit quantiser inside a loop with an integrator and measured what came out: the error that would have been spread flat across the whole sample rate is pushed up out of the band of interest instead, and the part left inside the band falls by about nine decibels for every doubling of the oversampling ratio. Three times what plain oversampling gives, from one integrator.

The obvious question is what a second integrator does, and the obvious answer — fifteen decibels an octave instead of nine — is right. This essay measures it, finds it about a decibel short at every order for a reason worth the finding, and then measures what the second integrator charges.

The price is the interesting half, because it is not a frequency and not a number of bits. It is an amplitude. A first-order loop works at any input inside full scale. A second-order loop is at its best at six tenths of full scale and worse above it, a fourth-order loop’s integrators run away at seven tenths, and neither boundary is anywhere in the expression that says fifteen decibels an octave.

A second integrator is 5.8 more decibels an octave, and a third 5.4 more. computed by solving, not by drawing. Modulators of order 1, 2, 3 marched one sample at a time with a one-bit quantiser, their in-band noise read from the transform of the error with the test tone a quarter of the way up the band. The measured slopes are 8.17, 13.93, 19.33 decibels per doubling of the oversampling ratio, against the 9, 15, 21 the white-noise argument predicts and the 3.01 plain oversampling gives. Each order is short of its own prediction by about a decibel, in the same direction, which is the error in the band not being white. The straight lines are each ladder's prediction drawn through its own first point, so what is compared is a slope against a slope.
Fig. 1 Three loops of one, two and three integrators, each marched sample by sample with a one-bit quantiser in it, and each measured against its own straight line. The slopes are the shaping law with the order in it; the gaps to the straight lines are the subject of the middle of this essay.

The law, and why it has the order in it

An integrator in a loop with the quantiser makes the loop’s error at the output the quantiser’s error multiplied by 1z11 - z^{-1}. That factor is small near direct current — it is zero at zero frequency — and it is large near half the sample rate, which is the whole mechanism: the error is not reduced, it is moved.

Two integrators multiply it by (1z1)2(1 - z^{-1})^2, and LL of them by (1z1)L(1 - z^{-1})^L. Near the bottom of the band the magnitude of that factor is (2πf/fs)L(2\pi f/f_s)^L, so the error power inside a band BB scales as B2L+1B^{2L+1} and the ratio improves by

3(2L+1) dB per doubling of fs/2B3(2L + 1)\ \text{dB per doubling of } f_s/2B

which is 9.03 for one integrator, 15.05 for two and 21.07 for three. Plain oversampling — the same quantiser with no loop at all — gives 3.01, and the difference between three and nine is the reason the field exists.

Measured on the marched loops, with each order’s noise read out of a transform of its own error: 8.17, 13.93 and 19.33. Every one of the three is short of its prediction, and short by about the same amount.

One bit, oversampled — and where the quantisation noise went. computed by solving, not by drawing. A first-order modulator is marched forward one sample at a time with a one-bit quantiser inside the loop, and the noise inside the band is read out of the transform of the error. It falls by 8.99 dB for every doubling of the oversampling ratio — measured 9.33, 10.12, 6.96, 9.54 — against 3.01 dB for plain oversampling, which is drawn beside it from the same starting point. The loop does not make less noise; it moves the noise out of the band, and at a ratio of 128 one bit is worth 9.18.
Fig. 2 The rung below, drawn again: one integrator against plain oversampling’s 3.01 dB an octave. The difference between the two curves is a difference in kind, and everything in this essay is about the second derivative of the same picture.
6.02 bits + 1.76 dB, measured — and the overload that is blamed on it. computed by solving, not by drawing. A coherent sinusoid is quantised and the ratio is read off the error sequence, never from the formula. One step inside full scale the two agree to 0.15 dB at every bit count from 8 to 16. Driven to exactly full scale the same converter measures 0.83 dB worse at 8 bits when driven to exactly full scale, and the reason is in the count beside it: 327 of 8192 samples hit the top code. A mid-tread converter's largest code is one step below full scale, so a sinusoid that reaches full scale is already overloading — half a step of overload, at the peak, where the error correlates with the signal. The loss halves with every bit for the same reason the clipped count does — 0.83, 0.47, 0.21, 0.06, -0.13 dB — and by sixteen bits it is inside the measurement's own scatter. The formula was never the approximation.
Fig. 3 What the quantiser on its own is worth, from the field’s own essay on it: six decibels a bit, measured on records rather than quoted. A shaping loop is a way of buying bits without buying levels, and this is the exchange rate it is being compared against.

Where the missing decibel is

A shortfall of the same size at every order is not three discrepancies; it is one, and it is in the step of the derivation that nothing in the loop enforces.

The step is this: the quantiser’s error is treated as white noise, uncorrelated with the input and spread evenly across every line up to half the sample rate. Nothing in a comparator makes that true. The error is a deterministic function of the input and of the loop’s own history, and whether it looks like noise is a measurement rather than an assumption.

So measure it. The error’s spectrum below the band edge has 256 lines in it at an oversampling ratio of 64, and if the error were white, any five of them would hold five parts in 256 — 1.95 per cent — of the in-band error. For a first-order loop driven by a tone inside its own band, the five largest lines hold 74.6 per cent, and they sit at two, three and four times the input frequency.

One integrator: 74.6% of the in-band error is in five lines. computed by solving, not by drawing. Every line of the error below the band edge, for an order-1 modulator with its test tone 5.08 kHz, a quarter of the way up the band. The five largest lines hold 74.6 per cent of the error against the 1.95 per cent a white error spread over 256 lines would put in any five, and they are at 2×, 3× the input frequency. The white-noise argument the shaping law rests on is a statement about this picture, and it is true of some of these loops and not others.
Fig. 4 Every line of the in-band error of a first-order loop. Three quarters of it is in five lines, at harmonics of the input: the “floor” the shaping law is a law about is, at this order, a set of tones.

That is not a floor. It is distortion, and it is the same phenomenon this field measured two rungs earlier under a different name — a quantiser whose error becomes harmonics of its input when the input does not exercise enough levels. A one-bit quantiser exercises exactly two, so it is the extreme case of that argument, and the loop is the only thing standing between it and complete failure.

The amplitude at which a converter's floor becomes distortion. computed by solving, not by drawing. The quantisation error is transformed and the power in harmonics of the input is measured directly, at the bins those harmonics occupy. Undithered, the share rises from 0.29% at 230 levels to 76.5% at 1.3: the error has stopped being spread and has become a deterministic staircase locked to the signal. The sweep is drawn against the levels the input uses rather than against volts because it is then the same sweep for every converter — a twelve-bit part and a sixteen-bit part agree here to 0.0e+0, so what decides the character of the error is how many levels the signal crosses and not how many the converter owns. With 1 least significant bit of dither the share stays under 0.34% at every amplitude, for 3.03 dB of signal to noise. Adding noise to a converter's input improves what comes out of it, which is true and sounds like it should not be — and the amount is one whole step, not "some": a quarter of a step leaves 52.7% and a half leaves 25.6%, because a dither smaller than a step cannot make the quantiser cross one.
Fig. 5 The argument this is the extreme case of, from the field’s own essay: the amplitude below which a quantiser’s error stops being spread and becomes harmonics of the signal. One bit is the far right of that problem, permanently.

Each added integrator breaks the tones up further, and that is the second thing an order buys. The five largest lines hold 74.6 per cent of the error at one integrator, 48.1 at two and 27.0 at three — and even at three the error is fourteen times further from white than white would be. The white-noise argument is not wrong so much as approached asymptotically, which is exactly why the measured slopes approach their predictions from below.

3 integrators: 27.0% of the in-band error is in five lines. computed by solving, not by drawing. Every line of the error below the band edge, for an order-3 modulator with its test tone 5.08 kHz, a quarter of the way up the band. The five largest lines hold 27.0 per cent of the error against the 1.95 per cent a white error spread over 256 lines would put in any five, and they are at 3× the input frequency. The white-noise argument the shaping law rests on is a statement about this picture, and it is true of some of these loops and not others.
Fig. 6 Three integrators, the same input, the same band. The lines are still there and still at multiples of the input frequency; there is simply much less in them. The error is closer to white and the slope is correspondingly closer to its prediction.

A measurement that was of the wrong signal

Getting the previous section’s numbers required repairing something, and the repair is worth stating because the defect is invisible from every direction except the one it was found from.

This site’s modulator took an fSignal argument, ignored it, and placed its test tone with the same helper every other figure in the field uses for a coherent record — which chooses a cycle count near a third of the record length. That puts the tone at a third of the sample rate. At an oversampling ratio of 64 with a 20 kHz band, the sample rate is 2.56 MHz and the tone was at 853 kHz: forty times above the band the ratio was being quoted over.

So the quantity reported as “the in-band signal to noise” had a numerator that was not in the band.

The correction is not small and it is not a constant. The same first-order loop, same amplitude, same oversampling ratio, measures 88.6 dB with the tone above the band and 47.5 dB with it inside — a factor of a hundred and thirteen in error power. A large out-of-band input dithers a one-bit loop thoroughly, which is a real technique for measuring a noise transfer function without the signal in the way, and it is not a measurement of a converter.

The same loop, driven above its band: 5.7% in five lines and 88.6 dB. computed by solving, not by drawing. Every line of the error below the band edge, for an order-1 modulator with its test tone at 853 kHz, above the 20 kHz band. The five largest lines hold 5.7 per cent of the error against the 1.95 per cent a white error spread over 256 lines would put in any five. The white-noise argument the shaping law rests on is a statement about this picture, and it is true of some of these loops and not others.
Fig. 7 The same loop with its tone at 853 kHz, above the band it is measured over. The five largest lines hold 5.7 per cent instead of 74.6, the spectrum is smooth, and the number that comes out is 41 dB better and about a different thing.

Both pictures are of the same modulator. Only one of them is of a converter, and the machinery here now places the tone inside the band, refuses a request for one outside it, and keeps the old placement available under a name — tone: "wide" — so that the defect can be reproduced rather than described.

What the second integrator costs

Now the half of the trade that does not appear in 3(2L+1)3(2L+1).

A modulator is not a linear system with a noise source in it, whatever the derivation treats it as. It is a marched nonlinear loop whose integrators accumulate the difference between what was asked for and what one bit could deliver. While the input is small that difference alternates in sign and the states stay bounded. While it is large the quantiser spends long runs saturated at one level, the integrators charge in one direction, and what they accumulate has to come back out later.

For one integrator it always comes back. Swept from a twentieth of full scale to 0.99 of it, the state of a first-order loop never exceeds four tenths of full scale and the ratio rises monotonically the whole way: there is no amplitude edge inside full scale at all.

2 integrators: the best input is 0.6 of full scale, not full scalecomputed by solving, not by drawing. The in-band signal-to-noise ratio of an order-2 modulator against its input amplitude, with the largest excursion of any integrator drawn beside it against a scale of 4 times full scale. The ratio is best at 0.6 of full scale (64.5 dB) and is three decibels below that by 0.9, with the states bounded everywhere the sweep goes. A single integrator has no such edge at all; four have one at 0.7 of full scale. The price of the shaping is an amplitude, and it is the loop that sets it rather than the reference.02040600.2000.4000.6000.800input amplitude (of full scale)in-band signal to noise (dB)best 0.63 dB downintegrator swing, on a second scale of 0 … 4× full scaleorder2loop coefficient0.2oversampling64best64.5 dB at 0.63 dB down at0.9states run away atnot inside 0.99state limit10× full scalesolved, then checked — one bit, marchedno runaway inside full scale
Fig. 8 A second-order loop’s ratio against its input amplitude, with the largest excursion of its integrators drawn on a second scale. The ratio is best at 0.6 of full scale and three decibels down by 0.9 — and the reason is beside it, in the state that has doubled over the same span. Drag it to one, three and four integrators.

For two it does not. The ratio peaks at 0.6 of full scale and is three decibels below its own best by 0.9, with the integrator swing rising from 0.3 to 1.7 times full scale over the same span. For four integrators the states pass ten times full scale — the stated limit, since an integrator asked to swing ten times its own reference is a circuit nobody has — at 0.7, and past that the march reports a refusal rather than a ratio.

4 integrators: the best input is 0.5 of full scale, not full scale. computed by solving, not by drawing. The in-band signal-to-noise ratio of an order-4 modulator against its input amplitude, with the largest excursion of any integrator drawn beside it against a scale of 4 times full scale. The ratio is best at 0.5 of full scale (86.6 dB) and is three decibels below that by 0.6, with the integrator states past 10 times full scale at 0.7. A single integrator has no such edge at all; four have one at 0.7 of full scale. The price of the shaping is an amplitude, and it is the loop that sets it rather than the reference.
Fig. 9 Four integrators. The extra order is worth another twenty decibels where it works, and it stops working at seven tenths of full scale: the curve ends because the states left the range in which any of this is a circuit.

The three statements are different and it matters that they are:

  • the best amplitude, where the ratio is largest;
  • the useful edge, where the ratio has fallen three decibels below that best — which is a degradation and returns a number;
  • the runaway, where the states leave the range a real integrator has — which is not a degradation and returns nothing at all.

For a second-order loop those are 0.6, 0.9 and nowhere inside full scale. For a fourth-order loop they are 0.5, 0.6 and 0.7. The gap between the second and the third is where a real modulator lives, and it is the reason converter data sheets specify a maximum input several decibels below the reference voltage — a number that looks like conservatism and is a stability margin.

Why this is an amplitude boundary and not a stability margin

A reader from the feedback field will want to call this an instability and reach for a phase margin. The reach is worth following because of where it fails.

The loop is a feedback loop: an integrator, unity feedback, a comparator in the forward path. If the comparator were a linear gain the loop would be trivially stable at any input, because the whole thing would be a linear system and a linear system’s stability has nothing to do with the size of its input. The comparator is not a linear gain. Its effective gain is the ratio of what it puts out to what it is given, and since it puts out ±1 whatever it is given, that gain falls as the input to it grows.

So the loop’s gain is a function of its own signal amplitude, and a second-order loop that is stable at small signals has less loop gain at large ones. That is the mechanism, and it is why the edge is an amplitude rather than a frequency: nothing about the poles moved. What moved is where on the comparator’s own curve the loop is sitting.

It also explains the shape of the ratio curve, which falls before anything dramatic happens. Long runs at one level are exactly the condition under which the error stops being spread, so the tonal share rises with the amplitude at the same time as the loop gain falls, and the ratio gives out for two reasons that arrive together.

What this costs in front of the converter

Everything above is about the loop. The reason a designer takes a higher order at all is that the alternative is a higher oversampling ratio, and that is paid for somewhere else.

At a fixed target, a second integrator is worth about six decibels an octave, which is two octaves of oversampling ratio — a factor of four in clock rate, in settling time per sample, in the switched capacitor’s own noise, and in power. Against that, a second integrator is one amplifier and a stability constraint on the input range.

The exchange is what makes the amplitude edge a design quantity rather than a curiosity, and it also sets the practical ceiling on the order. Third and fourth-order single-loop modulators are built and they are built with their coefficients scaled down, which is visible in these measurements: the loop coefficient in every integrator here is a stated argument, and lowering it moves the states down and the tonal share up. There is no setting at which either is free.

Where this ladder goes next

Three questions are opened here and the machinery exists for all three.

A multi-stage arrangement — two low-order loops with the second one digitising the first one’s own error — gets the slope of a high order without the amplitude edge of one, because no single loop is ever asked for more than it can hold. It is the standard answer to everything this essay measures, and the honest version of the claim needs the analogue mismatch between the two paths, which is what decides whether the cancellation is real.

Two loops, and the mismatch between them makes that measurement, and its answer is a range rather than a verdict: the cancellation is between an analogue path and a digital one, it is worth 25 decibels, and it is worth 25 decibels until the two differ by five per cent. That is the shape this essay’s amplitude edge has been replaced by — not removed, exchanged. A single fourth-order loop has states that run away at seven tenths of full scale; two second-order loops have no such amplitude anywhere, and instead have a matching requirement in components, which is a quantity a manufacturing process rather than a signal decides.

A multi-bit quantiser in the same loop moves the tonal share directly: the argument that a quantiser’s error is white is about how many levels the signal visits, and four bits visit sixteen. It is when a floor stops being a floor that measures how strongly that argument binds — the share of a quantiser’s error power sitting in harmonics of the input rises from 0.29 per cent at 230 levels to 76 per cent at 1.3, with the total unmoved throughout — so a one-bit loop sits at the far end of that curve by construction and every added level walks back along it. It should improve the shortfall this essay measures at every order, and it costs the linearity of the levels themselves, which no amount of shaping repairs.

A multi-bit quantiser in the same loop moves the tonal share directly: the argument that a quantiser’s error is white is about how many levels the signal visits, and four bits visit sixteen. It should improve the shortfall this essay measures at every order, and it costs the linearity of the levels themselves, which no amount of shaping repairs.

And the analogue integrator is the one that would make this a circuit rather than a march. Every integrator here is exact. A real one has finite gain, an offset and a settling time, and the switched-capacitor essays on this site already measure what each of those does to a stage. The amplifier inside the sample has the settling result: the number of times a sampled amplifier’s white noise folds into the band is exactly the number of time constants the settling needs, so asking for two more bits of settling costs fifteen per cent more noise before anything else has changed. The offset that knows the signal has the offset one, and it is not the offset a data sheet would call it: the charge a switch leaves behind depends on the input through two terms at once, so 5.67 mV of apparent offset moves by 1.86 mV across a volt of signal — a gain error of 0.186 per cent and only 3.4 µV of anything else. A gain error inside a shaping loop is a change in the loop’s own coefficients, which is the quantity the order-dependent slope measured here is a function of.

Which is the general point about the three items on this list. Every one of them replaces an idealised element by a real one, and in every case what arrives is not noise added to this essay’s result but a different value of one of this essay’s parameters — a matching tolerance, a level count, a loop coefficient. The amplitude edge measured here is a property of the recursion, and the recursion is what a real integrator changes.

What the loop is measured against

A shaped loop that gives up its advantage near full scale is measured against three results that do not. One bit, and where the noise went is the shaping law itself, nine decibels an octave against plain oversampling’s three. Six decibels a bit, and the half step blamed on it is the multi-bit quantiser this is an alternative to, with its own full-scale defect and a quite different cause. Two loops, and the mismatch between them is the cascade that buys order and pays in matching. What the filter in front costs is the analogue price of the oversampling all of it depends on, and When a floor stops being a floor is the same failure in a converter without a loop at all.

What is checked

Each of the three ladders is asserted to be stable at every oversampling ratio drawn, and to buy its own 3(2L+1)3(2L+1) decibels a doubling to within a couple of decibels — so the assertion carries the order in it rather than a number that would pass for any loop. The first-order case that law is anchored on is one bit, and where the noise went, where the measured 8.99 decibels a doubling sits against plain oversampling’s 3.01 and the octaves scatter by a decibel each — which is the loop telling the truth about what its error is made of, and the reason a slope here is quoted with its scatter rather than fitted and rounded. Every measured slope is asserted to be short of its prediction and short by about the same amount at every order, which is the claim that the shortfall is one phenomenon rather than three.

The tonal share is asserted against what white would give — five lines of 256 — rather than against a constant, so the check moves with the record and the oversampling ratio. It is asserted to fall with every added integrator and to still be an order of magnitude from white at three.

The amplitude sweep asserts that the best input is inside full scale rather than at it, that a single integrator has no runaway anywhere in the sweep, and that four integrators have one at or below seven tenths — the two ends that make the edge a property of the order. The out-of-band measurement is asserted to differ from the in-band one by more than twenty decibels, which is the repaired defect kept as a live check rather than a note.

The record length is chosen so that at least 256 lines lie below the band edge, because the first version of the third-order ladder reported 101.6 dB at an oversampling ratio of 256 and 110.5 dB when the record was made four times longer. That octave was measuring the record.

What is not modelled: the analogue integrators, which are exact here; the comparator’s own offset and hysteresis, which decide the idle-tone pattern at small inputs; the decimation filter, which is where a real converter’s in-band result is actually read; and the multi-stage arrangement, which is the standard way of getting these slopes and is not a single loop at all.

Part 2 on noise shaping

One argument about Noise shaping, 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 objects named here

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

Design tradeoffEffective bitsIdle tonesModel rangeNoise shapingOversamplingQuantisationStability