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

D5 · Lesson 7 · Fast convolution and filter banks

Filtering by multiplying spectra, why the FFT computes circular convolution and how zero padding makes it linear, overlap-add processing in blocks, when the FFT beats a direct FIR filter, the latency it costs, and splitting a signal into many channels with a DFT filter bank

Convolving a signal with a 10,000-tap impulse response, the reverberation of a concert hall, say, takes 10,000 multiplications for every output sample: almost half a billion a second for CD audio. But convolution in time is multiplication in frequency, and the FFT gets to frequency cheaply. Transform a block, multiply by the filter's spectrum, transform back, and the cost per sample grows only with the logarithm of the filter's length. Long filters, room simulators and the channelizers that split a wideband radio into hundreds of channels all work this way.

  • Real multiplications per output sample for an N-tap FIR filter, computed directly (N) and by FFT overlap-add with a transform of the next power of two at least 2N (counting 4 real multiplications per complex one).
  • For short filters, direct wins; past about 64 taps the FFT method wins, and by thousands of taps it's tens of times cheaper.
  • The cost is latency: the FFT method has to collect a whole block before producing any output.

Predict

A 1024-tap filter runs by overlap-add with 2048-point FFTs. About how many complex multiplications does each output sample cost?

Name it

Convolution by FFT

Convolution in time is multiplication in frequency, but the DFT's version is circular: the end of the output wraps around onto the start. Convolving a B-sample block with an N-tap filter makes B+N−1 outputs, so the transform length must be

L≥B+N−1

with the block and the filter zero-padded to L. Then the circular result equals the linear one.

Overlap-add

Cut the input into blocks of B samples, convolve each by FFT, and add each result's N−1 sample tail onto the start of the next. (Overlap-save instead overlaps the input blocks and discards the wrapped samples.) Per block the work is two L-point FFTs plus L products, about Llog2⁡L+L complex multiplications, for B outputs.

Latency

Nothing comes out until a block has been collected: at least B samples of delay, which matters for live audio. Real-time convolvers split the filter into short and long partitions to keep the delay small.

Filter banks

A bank of M bandpass filters spaced fs/M apart can share one prototype low-pass and one M-point FFT: the input passes through the prototype's M polyphase branches, and the FFT turns their outputs into M channels at once. Radio channelizers, audio codecs (MP3, AAC) and the OFDM receivers of D4 are built on this.

Worked example

What transform length handles 3000-sample blocks with a 1000-tap filter, and what's the first block's latency at 48 kHz with B = 1025?

Show the solution
  1. Transform length. L≥3000+1000−1=3999 so a 4096-point FFT.
  2. Block size. With 2048-point FFTs and a 1024-tap filter, B = 1025 samples.
  3. Latency. 102548000Hz=21.4ms before the first output.

Answer a 4096-point FFT, and with B = 1025 the first output comes 21.4 ms after the start.

Worked example

A 48 kHz signal is split into 64 channels by a DFT filter bank. How far apart are they?

Show the solution
  1. Channel spacing. 48000Hz64=750Hz
  2. Rate after the bank. Each channel can be decimated by up to 64 (lesson 9), so the total sample rate stays 48 kHz.

Answer the channels are 750 Hz apart.

Worked example

How much does FFT convolution save over direct convolution for a 1000-tap filter with 4096-point transforms?

Show the solution
  1. Outputs per block. 4096−1000+1=3097
  2. Cost per block. Two FFTs and a spectrum product take about 2×2048×12+4096=53248complex multiplies
  3. Cost per output. 532483097=17.2 complex multiplies, or about 69 real multiplies.
  4. Compare. Direct convolution takes 1000 multiplies per output, about 15 times as many.

Answer FFT convolution does about 15 times less work: about 69 real multiplies per output against 1000.

Check

Blocks of 1000 samples are convolved with a 64-tap filter by FFT. What's the shortest transform that avoids wraparound?

Check

A 210-tap filter runs by overlap-add with FFTs twice that long. About how many complex multiplications does each output cost?

Check

An overlap-add convolver collects 1025-sample blocks at 44.1 kHz. What's its minimum latency?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

Check

A DFT filter bank splits a 1000 kHz signal into 16 channels. How far apart are the channels?

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

Check

An overlap-add filter has 500 taps and uses 2048-point FFTs.

(a)

How many new outputs does each block give?

(b)

How many times less work than direct convolution is it, counting 4 real multiplies per complex one?

Check

Overlap-add processes 256-sample blocks at 16 kHz.

(a)

What latency does collecting a block add?

Write units the way you normally would: 1.5 ms, 1500 µs and 0.0015 s are the same answer.

(b)

How many blocks a second?

Explain why

Why does the FFT method of convolution need zero padding?

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.