Skip to content

Oversampling and noise shaping

See why sampling faster gains 3.01 dB per doubling, and how feeding the error back pushes it up in frequency, where a filter removes it.

Before this10.4 · 11.1 · 6 more
Chapter 11 · Lesson 3 of 3

First, the picture

The same quantizer error, shared among more slices of frequency. Watch the noise in the band fall while the total stays put.

More slices, same noise

Each bar is a slice of frequency as wide as the signal's band.

Sampling at exactly twice the band: all of the error's power, Δ²/12, sits in the band.

oversampling ratio OSR
1
noise in the band
0.00 dB
total noise
0.00 dB
0.00 / 12.00 s
Describe this picture

A bar chart with no control. Each bar is a slice of frequency as wide as the signal’s band, and its height is the share of the error’s power in that slice. The picture steps through OSR=1,2,4,8,16\mathrm{OSR}=1,2,4,8,16. The first bar is in the accent colour, labelled “the band we keep”; the rest are muted, labelled “removed by the digital low-pass”. The readouts are the oversampling ratio, which counts the slices, and the noise in the band and the total noise, in decibels relative to OSR=1\mathrm{OSR}=1. At the start the caption says: “Sampling at exactly twice the band: all of the error’s power, Δ²/12, sits in the band.” The noise in the band reads −3.01, −6.02, −9.03 and −12.04 dB as the slices double, and the total noise stays at 0.00 dB.

Sharing the same error among more slices

Quantization & noise (11.1) fixed the quantizer’s error power at Δ2/12\Delta^2/12 per sample, where Δ\Delta is the step. That number depends on the step and on nothing else, so sampling faster does not change it. There are two ways to a cleaner signal from the same bits. This page takes both: sample faster and filter, then push the error up in frequency with feedback.

Here is the idea behind that picture. For a busy signal the error behaves like hiss, and its power Δ2/12\Delta^2/12 is spread evenly over all frequencies from 0 to fs/2f_s/2. I state this here; 24.4 proves it. Your signal occupies only the band from 0 to fBf_B. Cut the range 0 to fs/2f_s/2 into slices, each fBf_B wide. The number of slices is the oversampling ratio,

OSR=fs2fB.\mathrm{OSR}=\frac{f_s}{2f_B}.

At OSR=1\mathrm{OSR}=1 there is one slice: you sample at 2fB2f_B, the slowest rate that still holds the band (The sampling theorem, 10.2).

The picture at the top of the page starts there. The noise is in decibels relative to OSR=1\mathrm{OSR}=1, the power ratio 10log⁡1010\log_{10} from How big is a signal (1.3). Sampling at exactly twice the band, all of the error’s power, Δ2/12\Delta^2/12, sits in the band.

At OSR=2\mathrm{OSR}=2, twice as fast, the same power is shared by two slices. The filter keeps one: −3.01 dB. At OSR=4\mathrm{OSR}=4 the same power is shared by four slices, and a digital low-pass that keeps only the first one keeps a quarter of it. That is the ideal low-pass of Frequency response and Bode plots (8.4), done in software. A quarter of the power is

10log⁡1014=−6.02 dB.10\log_{10}\tfrac14=-6.02\ \text{dB}.

Each doubling of the rate, one octave, halves the power that is kept: −3.01-3.01 dB, because 10log⁡102=3.0110\log_{10}2=3.01. At OSR=8\mathrm{OSR}=8, eight times faster, there are eight slices, and the filter keeps one: −9.03 dB. At OSR=16\mathrm{OSR}=16 the band holds −12.04-12.04 dB. At 6.02 dB per bit that is two extra bits of quality.

Look at the total noise. It never leaves 0.00 dB. Sampling faster only spreads the error thinner. Without the low-pass nothing is gained; the filter, keeping the first slice, does all the work.

Averaging four readings of a noisy scale halves the noise’s RMS. That is the same arithmetic: four readings, a quarter of the power.

The maths behind it · averaging independent readings

Averaging RR independent readings divides the mean square of their noise by RR. Oversampling with a low-pass is that average, done by a filter.

What a first difference does to slow and fast wiggles

Now the second move. Draw the loop as in Difference equations (6.1): quantize, keep the quantizer’s error in a delay box, and subtract it from the next input. The quantizer adds its own error e[n]e[n] to whatever enters it, so with the stored error taken off the input,

y[n]=Q{x[n]−e[n−1]}=x[n]−e[n−1]+e[n].y[n]=Q\{x[n]-{e[n-1]}\}=x[n]-{e[n-1]}+e[n].

This is error feedback. The error reaching the output is e[n]−e[n−1]e[n]-{e[n-1]}, which is the first difference of ee from Operations on amplitude (2.2).

How does a first difference treat slow and fast wiggles? I measure it with test sines, as in Properties of LTI systems (5.4): a sine goes in, a sine of the same frequency comes out, scaled. The scale is what I want. The next picture runs four test sines, from slow to almost the fastest wiggle, Ω=π\Omega=\pi (Sinusoids, 3.2). Watch the first difference shrink the slow one and grow the fast one.

A first difference, measured with test sines

Size out ÷ size in, for four test frequencies.

A slow test sine, Ω = π/20: its first difference is only 0.157 of its size.

test frequency Ω
π/20 rad/sample
size out ÷ size in
0.157
0.00 / 12.00 s
Describe this picture

Two panels with no control: size out ÷ size in, for four test frequencies. The top panel shows stems of the test sine and of its first difference over samples n=0n=0 to 39. The lower panel puts one labelled dot per test at its test frequency Ω\Omega, from 0 to π\pi rad/sample. The readout is size out ÷ size in, the ratio of RMS values over whole periods, to 3 decimals. The picture plays by itself through Ω=π/20\Omega=\pi/20, π/3\pi/3, π/2\pi/2 and 19π/2019\pi/20, reading 0.157, 1.000, 1.414 and 1.994, with a caption at each; the last reads “Ω = 19π/20, almost the fastest wiggle there is: 1.994 times the input. Slow error nearly cancels; fast error comes out doubled.”

The slow test sine, Ω=π/20\Omega=\pi/20, has a first difference only 0.157 of its size. At Ω=π/3\Omega=\pi/3, one cycle every 6 samples, the first difference is exactly as big as the input, 1.000. At Ω=π/2\Omega=\pi/2, one cycle every 4 samples, it is 1.414 times the input. At Ω=19π/20\Omega=19\pi/20, almost the fastest wiggle there is, it is 1.994 times the input.

The dots rise from almost 0 to almost 2. At Ω=π/3\Omega=\pi/3 the ratio is 1.000, the crossover: slower wiggles shrink, faster ones grow. A first difference nearly cancels slow wiggles and doubles the fastest ones. Subtracting yesterday’s temperature from today’s does the same: the slow seasonal drift nearly vanishes, and the day-to-day jumps stay.

The dots lie on a smooth curve from 0 to 2. Its formula comes with the DTFT, in Frequency response of discrete-time systems (12.4). Power goes as size squared (1.3), so shaping multiplies the error’s power at Ω\Omega by the square of the dot’s value: 0.025 at π/20\pi/20 and 3.98 at 19π/2019\pi/20. Feed the error back twice and the error is differenced twice. That is second order shaping, and it squares the sizes again: 0.025, 1.000, 2.000 and 3.975 at the four tests.

The maths behind it · eigenvectors of a matrix

For signals that run on in both directions, the first difference is a matrix with 1 on the diagonal and −1-1 just below it. A test sine comes out as the same sine, scaled. A vector that a matrix only scales is an eigenvector; 5.4 met this idea for LTI systems.

Push the error up, then filter it away

Put the two moves together at OSR=16\mathrm{OSR}=16. Shaping multiplies each slice’s power by the curve squared. The band’s slice nearly empties, and the slices at the top fill up. I can then low-pass, keep the first slice, and throw the rest away. Watch the band’s bar empty as the top bars grow.

Push the error up, then filter it away

OSR 16: sixteen slices. Bars are each slice's share of the unshaped error power.

Sixteen times oversampled, no shaping: every slice holds 1/16 of the error's power. The band's slice: −12.04 dB.

shaping
none
noise in the band
−12.04 dB
total noise
0.00 dB
0.00 / 12.00 s
Describe this picture

The same bar chart, for OSR=16\mathrm{OSR}=16: sixteen slices, each bar its share of the unshaped error power. A readout names the shaping, “none”, then “first order”, then “second order”, and the bars morph from one to the next; with no shaping every bar is 0.0625. The noise in the band reads −30.96 dB for first order and −47.33 dB for second, and the total noise +3.01 dB and +7.78 dB. The last caption reads “Feed it back twice: −47.33 dB in the band, +7.78 dB in total. Push the error up in frequency, then filter it away.”

With no shaping every bar is 0.06250.0625, a sixteenth. First-order bars run from 0.0008 and 0.0056 in the lowest slices to 0.2492 in the top one. Second-order bars run from 0.00002 and 0.0006 to 0.9936. Feed the error back once, and its power moves toward the top slices. The band’s slice drops to −30.96 dB, though the total rose by 3.01 dB. Feed it back twice, and the band holds −47.33 dB while the total is +7.78 dB.

Notice that the noise in the band falls while the total noise rises. Adding the sixteen bars gives 2 for first order and 6 for second, so the total power is multiplied by 2 and by 6, which is +3.01+3.01 dB and +7.78+7.78 dB. Shaping moves the error and also adds to it. It still wins, because the part it adds sits in slices that the low-pass removes.

That is sweeping dust into the corner you will vacuum. Left out of this page: stability for orders above 2, cascaded loops, and the design of the decimation filter, which waits for Chapter 22.

One bit at a time

Take a first-order loop whose quantizer has only one bit, so its output is +1+1 or −1-1, and give it a constant input of 0.5. The bits run 1,1,−1,11,1,-1,1 and repeat. Their running average is 0.5. With an input of 0.25 the bits are 1,−1,1,1,−1,1,−1,1,…1,-1,1,1,-1,1,-1,1,\dots and their average over 16 bits is 0.25.

input 0.5+1−1dashed line: average 0.5input 0.25+1−1dashed line: average 0.25
Fig. 1. With one bit, the share of +1s carries the value: for an input of 0.5, three +1s for every −1 average to 0.5. A digital low-pass (an average over many bits) turns the stream back into many-bit samples: a sigma-delta converter.

The average over many bits is the digital low-pass. A 1-bit loop followed by that average is a sigma-delta converter. Such loops can settle into short repeating patterns, called idle tones, which Dither (11.2) breaks up.

Worked example

Every number below was computed with OSR=fs/(2fB)\mathrm{OSR}=f_s/(2f_B) and the 6.02 dB per bit rule.

  1. Oversampling alone. In-band noise relative to OSR=1\mathrm{OSR}=1 for OSR=2,4,8,16,32,64\mathrm{OSR}=2,4,8,16,32,64 is −3.01-3.01, −6.02-6.02, −9.03-9.03, −12.04-12.04, −15.05-15.05, −18.06-18.06 dB. That is 3.01 dB per octave. OSR=16\mathrm{OSR}=16 is worth 2.0 bits, and OSR=64\mathrm{OSR}=64 is worth 3.0 bits.
  2. First-order shaping. At OSR=16\mathrm{OSR}=16 the band holds −30.96-30.96 dB, or 5.1 bits. At OSR=64\mathrm{OSR}=64 it holds −49.01-49.01 dB, or 8.1 bits. Between those two the gain is 9.03 dB per octave.
  3. Second-order shaping. At OSR=16\mathrm{OSR}=16 the band holds −47.33-47.33 dB, or 7.9 bits. At OSR=64\mathrm{OSR}=64 it holds −77.41-77.41 dB, or 12.9 bits. The gain is 15.05 dB per octave.
  4. Totals. Shaped error power is multiplied by 2, 6 and 20 for orders 1, 2 and 3: +3.01+3.01, +7.78+7.78 and +13.01+13.01 dB.
  5. Test sines. Size out ÷ size in through one first difference, at Ω=π/20, π/3, π/2, 19π/20\Omega=\pi/20,\ \pi/3,\ \pi/2,\ 19\pi/20: 0.157, 1.000, 1.414, 1.994. Through two: 0.025, 1.000, 2.000, 3.975.
  6. A one-bit stream. Input 0.5 gives 1,1,−1,11,1,-1,1 repeating, average 0.5. Input 0.25 gives an average of 0.25 over 16 bits.

Where you’ll meet this

The curve you measured with test sines gets its formula in the DTFT, in 12.4. Cutting the sample rate after the low-pass, called decimation, is the subject of Chapter 22. Audio converters use these loops, and Chapter 29 comes back to them.

Reference card

QuantityFormulaNotes
Oversampling ratioOSR=fs/(2fB)\mathrm{OSR}=f_s/(2f_B)number of slices
Oversampling alonein-band noise ×1/OSR\times1/\mathrm{OSR}−3.01-3.01 dB per octave, only with the digital low-pass
Error feedbacky[n]=x[n]+e[n]−e[n−1]y[n]=x[n]+e[n]-{e[n-1]}first difference of the error
First differencesize ≈0\approx0 for slow, ≈2\approx2 for the fastest wigglesformula in 12.4
First-order shaping−9.03-9.03 dB per octave in the bandtotal error ×2\times2
Second-order shaping−15.05-15.05 dB per octave in the bandtotal error ×6\times6
Sigma-delta1-bit loop plus digital low-passshare of +1+1s carries the value

End of lesson 11.3

Where to go next.

Phasorium
LibraryEvery lesson, in order

Parts

About Phasorium
Look