C923 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

C9 · Lesson 23 · Digital processing of analog signals and changing the sample rate

Filters that run on samples, and moving between sample rates

Most filters today are a converter, a processor and another converter: sample the analog signal, run a difference equation, turn the result back into a voltage. Done right, the whole chain behaves exactly like an analog filter, and its cutoff moves when the sample rate does. Systems also have to move signals between rates all the time: audio recorded at 44.1 kHz and played at 48 kHz, a radio that samples fast and then works at a much slower rate. Dropping samples or inserting zeros sounds trivial, but each needs a filter, or aliases and images creep in.

  • The dashed curve is a signal's spectrum, occupying low frequencies up to ωb, plotted from 0 to π. The solid curve is the spectrum after inserting L − 1 zeros between every pair of samples.
  • At L = 1 nothing changes. Raise L: the spectrum is squeezed toward 0 by a factor L, and copies, the images, appear at multiples of 2π/L.
  • An interpolation filter keeps everything below the marker at π/L and removes the images; what's left is the same signal at L times the sample rate.

Predict

A signal sampled at 48 kHz contains a 10 kHz tone. Every fourth sample is kept, with no filter first. Where does the tone appear at the new rate?

Name it

Digital processing of analog signals

Sample at fs, filter with H(ejω), convert back. For a band-limited input the chain acts like an analog filter with

Heff(f)=H(ej2πf/fs)for |f|<fs/2

So a digital cutoff ωc is an analog cutoff fc=ωcfs/2π, and the same coefficients at twice the sample rate cut off at twice the frequency.

Decimation by M

Keep every Mth sample: the rate becomes fs/M and frequencies are stretched by M, ω→Mω. Anything above π/M beforehand aliases, so first low-pass to π/M (the anti-aliasing step done digitally).

Interpolation by L

Insert L − 1 zeros after each sample: the spectrum is squeezed by L, ω→ω/L, leaving L − 1 images in the band. A low-pass at π/L with gain L removes them and fills in the missing samples.

Rational rate changes

Up by L, filter at the lower of the two cutoffs, down by M: the rate becomes fsL/M. 44.1 kHz to 48 kHz is L/M = 160/147.

Oversampling

Sampling faster than needed relaxes the analog anti-aliasing filter (a wide guard band) and spreads the converter's quantization noise over a wider band: each doubling of the rate, filtered back down to the signal band, lowers the in-band noise by 3 dB, 10log10⁡(OSR) in all.

Worked example

A digital low-pass has ωc=π/4. What analog cutoff does it give at 48 kHz and at 96 kHz?

Show the solution
  1. Map to analog frequency. fc=ωcfs/2π=fs/8
  2. At each rate. That's 6 kHz at 48 kHz and 12 kHz at 96 kHz.
  3. Keeping 6 kHz. To keep 6 kHz at the higher rate, the coefficients must be redesigned for ωc=π/8.

Answer 6 kHz at 48 kHz and 12 kHz at 96 kHz.

Worked example

Convert 44.1 kHz audio to 48 kHz.

Show the solution
  1. Ratio in lowest terms. 48000/44100=160/147
  2. Upsample by 160. Insert 159 zeros between samples, which takes the rate to 7.056 MHz.
  3. Filter. Low-pass below 20 kHz or so, under both rates' Nyquist frequencies (22.05 kHz being the lower).
  4. Downsample by 147. Keep every 147th sample.
  5. In practice. A polyphase filter computes only the samples that are kept.

Answer upsample by 160, low-pass below about 20 kHz, then keep every 147th sample.

Worked example

A 1 kHz tone sampled at 8 kHz is upsampled by 3 (two zeros between samples). Where do images appear before the interpolation filter?

Show the solution
  1. New rate. The new rate is 24 kHz, so the spectrum now runs to a Nyquist frequency of 12 kHz.
  2. Images. Inserting zeros keeps the old spectrum and its copies around 8 kHz: below 12 kHz there are tones at 1, 7 and 9 kHz.
  3. The interpolation filter. It must keep 1 kHz and remove everything from 7 kHz up, which is why it's a low-pass with cutoff at the old Nyquist frequency, 4 kHz.

Answer images appear at 7 and 9 kHz, beside the 1 kHz tone.

Check

A digital filter's cutoff is ω = 0.5 rad. What analog cutoff does it give at 8 kHz?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

A signal at 48 kHz is decimated by 2.

(a)

What is the new sample rate?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

Below what ω (at the old rate) must the signal be filtered first?

Check

A 9 kHz tone at 48 kHz is decimated by 4 with no filter. At what frequency does it appear?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

A tone at ω = 0.6 is interpolated by inserting 2 − 1 zeros between samples.

(a)

Where is the tone after zero insertion?

Write units the way you normally would: 1.5 rad and 1500 mrad are the same answer.

(b)

Where is the lowest image?

Check

An 8 kHz signal is upsampled by 2 and then downsampled by 7. What is the final rate?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

Check

A converter oversamples by 16 and filters back down to the signal band. By how many dB does the in-band quantization noise fall?

Check

Why does interpolation's low-pass filter need a gain of L?

Check

A 96 kHz signal is decimated by 2.

(a)

What is the new sample rate?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

Below what frequency must the anti-aliasing filter keep the signal?

Check

A 2 kHz tone sampled at 8 kHz is upsampled by 4.

(a)

Where is the lowest image the interpolation filter must remove?

Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.

(b)

What is the new sample rate?

Explain why

Why must a decimator filter before it throws samples away, rather than after?

Practice

Keep practicing

11 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.