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

D5 · Lesson 9 · Decimation and interpolation

Changing a digital signal's sampling rate, decimation by keeping every Mth sample and the filter that must come first, interpolation by inserting zeros and the images it creates, rational rate changes such as 44.1 to 48 kHz, and polyphase filters that skip the work that would be thrown away

A digital audio workstation mixes tracks recorded at 44.1 and 48 kHz, a software radio digitizes 20 MHz of spectrum and then needs only a 200 kHz slice of it, and a delta-sigma ADC samples at megahertz to deliver a few kilohertz of clean audio. All of them change sampling rates. Doing it is simple in principle: throw samples away, or insert new ones. Doing it right means respecting the sampling theorem at the new rate, which takes a low-pass filter, and doing it efficiently means never computing a sample you're about to discard.

  • The spectrum of a signal occupying 0 to B kHz, sampled at 48 kHz, and the copies that land on top of it if it's decimated by M with no filter: decimating moves the sampling rate to 48/M kHz, so copies appear at every multiple of 48/M.
  • If B is below the new Nyquist frequency, 24/M kHz, the copies don't overlap the original. Above it they fold onto it: aliasing.
  • That's why decimation starts with a low-pass filter at the new Nyquist frequency.

Predict

A 48 kHz recording is decimated by 6 for an 8 kHz telephone link. What must the filter in front of the decimator do?

Name it

Decimation by M

Keep every Mth sample: the rate becomes fs/M, with Nyquist frequency fs/2M. To avoid aliasing, first low-pass filter to below fs/2M.

Interpolation by L

Insert L − 1 zeros between samples: the rate becomes Lfs, but the spectrum now contains images, copies of the original band around every multiple of the old rate (a tone at f0 reappears at fs−f0, fs+f0, ...). A low-pass filter at the old Nyquist frequency, with gain L, removes them and fills in the zeros with smooth values.

Rational rates

Interpolating by L and then decimating by M changes the rate by L/M. From 44.1 kHz to 48 kHz is

48,00044,100=160147

with one filter, cutting off at the lower of the two Nyquist frequencies, between the steps.

Polyphase filters

Filtering at the high rate and then discarding M − 1 of every M outputs wastes most of the work. A polyphase decimator splits the N-tap filter into M branches and computes only the outputs that are kept, so the cost falls from Nfs to Nfs/M multiplications per second. Interpolators likewise skip the multiplications by the inserted zeros.

Worked example

A 20 MHz digitized band is decimated by 64 for a single channel. What's the new rate, and what can the channel's bandwidth be?

Show the solution
  1. New rate. 20MHz64=312.5kHz
  2. Nyquist frequency. 312.5kHz2=156.25kHz
  3. Channel bandwidth. After a sharp filter, a real signal up to about 150 kHz wide fits, or a complex baseband signal twice that.

Answer the new rate is 312.5 kHz, room for a real channel about 150 kHz wide or a complex one twice that.

Worked example

A 2000-tap decimation filter runs at 48 kHz with M = 6. What does polyphase save?

Show the solution
  1. Direct. 2000×48000=96×106 multiplications per second.
  2. Polyphase. Only one output in six is ever computed: 96×1066=16×106

Answer polyphase cuts the work from 96 million to 16 million multiplications per second.

Worked example

48 kHz audio is interpolated by 4 to 192 kHz. Where do the images of a 10 kHz tone land, and what must the filter do?

Show the solution
  1. Where images come from. Inserting zeros copies the spectrum around multiples of 48 kHz.
  2. Images in the new band. Within 0 to 96 kHz the tone appears on each side of 48 kHz and just below 96 kHz: 48−10=38kHz48+10=58kHz96−10=86kHz
  3. The filter. A low-pass at the new rate with its cutoff near 24 kHz removes them, leaving only the 10 kHz tone at the higher rate.

Answer the images land at 38, 58 and 86 kHz, and a low-pass near 24 kHz at the new rate removes them.

Check

A 96 kHz signal is decimated by 2. Above what frequency must it be filtered out first?

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

Check

A 3 kHz tone sampled at 16 kHz is interpolated by 2 with zeros inserted. At what frequency is its first image?

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

Check

A 48 kHz signal is interpolated by 160 and decimated by 4. What's the new rate?

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

Check

A 1000-tap polyphase decimator runs at 48 kHz input with M = 16. How many million multiplications per second does it need?

Check

A 20 MHz signal is decimated by 16.

(a)

What is the new rate?

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

(b)

What bandwidth can survive without aliasing?

Check

A 500-tap decimation filter at 96 kHz decimates by 4.

(a)

How many million multiplies a second does it take, computed directly at the input rate?

(b)

And in polyphase form, in millions a second?

Explain why

Why must a decimator filter before it discards samples?

Practice

Keep practicing

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