---
title: Filter banks
heading: Splitting a signal into many bands at once, the uniform DFT filter bank, its polyphase-FFT implementation, critical and oversampled channelizers, and two-channel perfect reconstruction
eyebrow: S7 · Lesson 42 · Filter banks
xp: 50
---

::: hook
Audio codecs split sound into dozens of bands to spend bits where the ear notices; a cellular base station splits a wide slice of spectrum into hundreds of channels; a graphic equalizer splits music into octaves. Building each band's filter separately would be hopelessly expensive. A uniform DFT filter bank instead derives every channel from one prototype lowpass filter shifted in frequency, and by the polyphase tricks of lesson 7 the whole bank costs barely more than that single filter plus one FFT. With the right design, the bands can even be put back together into the original signal exactly.
:::

::: play
- Four adjacent channels of a uniform DFT filter bank with M channels, each a copy of the prototype lowpass response shifted by $2\pi k/M$; here the prototype is a length-L moving average.
- Channels sit $2\pi/M$ apart. A short prototype overlaps its neighbors heavily; a longer one gives sharper channels with deeper rejection between them.
- Real channelizers use prototypes many times longer than M, designed as in lessons 22 and 23, so each channel is clean.
:::
:::

```sim plot
view: graph
x: w = 0..3.1416
y: H = -50..2 dB
slider: M = 8..32 = 8 step 1
slider: L = 4..64 = 8 step 1
plot: 20*log(abs(sin(L*(w + 1e-9)/2)/(L*sin((w + 1e-9)/2)))) | samples: 1200 | label: channel 0
plot: 20*log(abs(sin(L*(w - 2*pi/M + 1e-9)/2)/(L*sin((w - 2*pi/M + 1e-9)/2)))) | samples: 1200 | color: ch2 | label: channel 1
plot: 20*log(abs(sin(L*(w - 4*pi/M + 1e-9)/2)/(L*sin((w - 4*pi/M + 1e-9)/2)))) | samples: 1200 | color: ch3 | label: channel 2
plot: 20*log(abs(sin(L*(w - 6*pi/M + 1e-9)/2)/(L*sin((w - 6*pi/M + 1e-9)/2)))) | samples: 1200 | dashed | label: channel 3
```

::: predict
## A 16-channel bank uses a 256-tap prototype at 48 kHz. Built as 16 separate 256-tap complex filters, it costs 4096 multiplications per input sample. Roughly what does the polyphase-FFT version cost?

- [ ] 4096
- [ ] 256
- [x] About 18: 16 for the polyphase filter plus about 2 for the FFT
- [ ] 1

::: reveal
About 18. With decimation by 16, the 256 prototype taps split into 16 polyphase branches that together use each tap once per output block, 256 multiplications per 16 inputs, or 16 per input sample. A 16-point FFT then forms all 16 channels at once, costing (16/2) × 4 = 32 complex multiplications per block, 2 per input. That's more than 200 times cheaper than separate filters.
:::
:::

::: nameit
## The uniform DFT filter bank

From a prototype lowpass $h_0[n]$ with bandwidth about π/M, channel k is

$$h_k[n] = h_0[n]e^{j2\pi kn/M}, \qquad H_k(e^{j\omega}) = H_0(e^{j(\omega - 2\pi k/M)})$$

centered at $2\pi k/M$, or $kf_s/M$ in hertz.

## Polyphase implementation

Write $H_0(z) = \sum_{p=0}^{M-1}z^{-p}E_p(z^M)$. Then all M channel outputs, decimated by M, come from

1. a commutator feeding each input sample to one of M polyphase branches $E_p(z)$, each running at $f_s/M$;
2. an M-point (inverse) DFT across the branch outputs, done by FFT.

Cost per input sample: N/M multiplications for an N-tap prototype, plus about $\frac{1}{2}\log_2M$ complex multiplications for the FFT, against MN for separate filters.

## Critical and oversampled banks

- **Critically sampled** (decimate by M): total output rate equals the input rate, but channels overlap their neighbors' alias regions, so reconstruction needs aliasing cancellation.
- **Oversampled** (decimate by D < M): each channel runs at $f_s/D$, leaving room for transition bands; used in channelizers and adaptive subband processing.

## Two-channel perfect reconstruction

Analysis filters $H_0$, $H_1$, decimation by 2, then interpolation and synthesis filters $G_0$, $G_1$. Choosing $H_1(z) = H_0(-z)$, $G_0 = H_0$, $G_1 = -H_1$ (a quadrature mirror filter bank) cancels aliasing; perfect reconstruction also needs $H_0^2(z) - H_0^2(-z) = 2z^{-d}$, which the Haar pair $\frac{1}{\sqrt{2}}[1, 1]$ and $\frac{1}{\sqrt{2}}[1, -1]$ satisfy. Cascading two-channel banks on the low band gives octave bands and, in the limit, the discrete wavelet transform.
:::

::: example
## A 32-channel DFT bank runs on 96 kHz audio. Where are the channels, and how fast does each output run if critically sampled?

::: solution
1. **Spacing.**
   $$\frac{96\ \text{kHz}}{32} = 3\ \text{kHz}$$
   so channel k is centered at 3k kHz.
2. **Negative frequencies.** Channels 17 to 31 are the negative frequencies of a real input.
3. **Output rate.** Critically sampled, each channel outputs at 96/32 = 3 kHz, complex, so the total data rate is preserved.

**Answer:** the channels are 3 kHz apart, channel k at 3k kHz, and each outputs complex samples at 3 kHz.
:::
:::

::: example
## Check that the Haar filters form a perfect-reconstruction QMF bank.

::: solution
1. **The filters.**
   $$H_0(z) = \frac{1}{\sqrt{2}}(1 + z^{-1})$$
   $$\begin{aligned} H_1(z) &= H_0(-z) \\ &= \frac{1}{\sqrt{2}}(1 - z^{-1}) \end{aligned}$$
2. **The reconstruction condition.**
   $$\begin{aligned} &H_0^2(z) - H_0^2(-z) \\ &= \tfrac{1}{2}[(1 + z^{-1})^2 - (1 - z^{-1})^2] \\ &= 2z^{-1} \end{aligned}$$
3. **Conclusion.** The output is the input delayed by one sample, exactly.

**Answer:** $H_0^2(z) - H_0^2(-z) = 2z^{-1}$, a pure delay, so the Haar bank reconstructs perfectly.
:::
:::

::: example
## A radio channelizer splits 100 MS/s into 1024 channels with a 16 384-tap prototype, critically sampled. Compare the polyphase-FFT cost with separate filters.

::: solution
1. **Polyphase branches.** Per input sample they cost N/M = 16 multiplications.
2. **FFT.** About $\frac12\log_21024 = 5$ complex multiplications.
3. **Total.** About 16 + 5 = 21 per input sample.
4. **Separate filters.**
   $$MN = 16.8\ \text{million}$$
   per input sample.
5. **Ratio.** About 800 000, which is why every wideband channelizer, from cellular base stations to radio telescopes, is built this way.

**Answer:** about 21 multiplications per input sample for the polyphase FFT, against 16.8 million for separate filters, some 800 000 times fewer.
:::
:::

::: check
given: s = 8 | 48 | 1000; M = 8 | 32 | 256
answer: s/M
unit: kHz
tolerance: 0.5%

## A uniform DFT filter bank with {M} channels runs at {s} kHz. How far apart are its channels?

::: right
Right. $f_s/M$ = {answer} kHz.
:::

::: misses
- [s/(2*M)] The channels divide the whole sample rate, not half of it.
- [any] Not yet. Channel k sits at $kf_s/M$.
:::
:::

::: check
given: s = 48 | 1000; M = 16 | 64; k = 3 | 10
answer: k*s/M
unit: kHz
tolerance: 0.5%

## Where is channel {k} of a {M}-channel bank at {s} kHz centered?

::: right
Right. $kf_s/M$ = {answer} kHz.
:::

::: misses
- [(k + 0.5)*s/M] In a standard DFT bank channel 0 is centered at DC.
- [any] Not yet. $kf_s/M$.
:::
:::

::: check
given: N = 128 | 512 | 2048; M = 8 | 32 | 64
answer: N/M + log(M)/log(2)/2
tolerance: 0.5%

## A polyphase-FFT channelizer has an N = {N}-tap prototype and M = {M} channels, critically sampled. About how many multiplications per input sample does it need?

::: right
Right. N/M for the polyphase branches plus $\frac{1}{2}\log_2M$ for the FFT: {answer}.
:::

::: misses
- [N + log(M)/log(2)/2] The polyphase branches run at the decimated rate: N taps per M inputs.
- [any] Not yet. Prototype taps per input plus FFT cost per input.
:::
:::

::: check
given: N = 128 | 512 | 2048; M = 8 | 32 | 64
answer: M*N/(N/M + log(M)/log(2)/2)
tolerance: 0.5%

## How many times cheaper is that channelizer than M separate N-tap filters at the full rate?

::: right
Right. MN against $N/M + \frac{1}{2}\log_2M$: {answer} times.
:::

::: misses
- [any] Not yet. Divide MN by the polyphase-FFT cost per input.
:::
:::

::: check
given: s = 48 | 192; M = 16 | 64; D = 4 | 8
answer: s/D
unit: kHz
tolerance: 0.5%

## An oversampled {M}-channel bank at {s} kHz decimates each channel by D = {D}. At what rate does each channel's output run?

::: right
Right. $f_s/D$ = {answer} kHz.
:::

::: misses
- [s/M] That's the critically sampled rate; this bank decimates by less.
- [any] Not yet. Each channel is decimated by D.
:::
:::

::: check
given: a = 0.5 | 1; b = 0.8 | 2; c = 0.3 | 0.6; w = 0.5 | 2
answer: sqrt((a - b*cos(w) + c*cos(2*w))^2 + (b*sin(w) - c*sin(2*w))^2)
tolerance: 0.5%

## $H_0 = [\given{a}, \given{b}, \given{c}]$. The QMF partner is $H_1(z) = H_0(-z)$. What's $|H_1|$ at ω = {w}?

::: right
Right. $H_1(e^{j\omega}) = H_0(e^{j(\omega - \pi)})$, the mirror image about π/2: {answer}.
:::

::: misses
- [sqrt((a + b*cos(w) + c*cos(2*w))^2 + (b*sin(w) + c*sin(2*w))^2)] That's $|H_0|$; replacing z by −z flips the sign of the odd taps.
- [any] Not yet. $H_1$ has taps [a, −b, c].
:::
:::

::: check
kind: parts
given: M = 64 | 256 | 1024; N = 8 | 16

## A critically sampled polyphase-FFT channelizer has M = {M} channels and an {N}M-tap prototype.

::: part
answer: N + 0.5*log(M)/log(2)
tolerance: 0.5%

### About how many multiplications does it need per input sample?

::: misses
- [N] Add the FFT's $\frac12\log_2M$.
- [any] $N_\text{taps}/M + \frac12\log_2M$.
:::
:::

::: part
answer: M*N*M/(N + 0.5*log(M)/log(2))
tolerance: 0.5%

### How many times cheaper is it than M separate filters at the full rate?

::: misses
- [any] $MN_\text{taps}$ divided by the polyphase cost.
:::
:::
:::

::: check
kind: derivation
vars: M = 2..4096, s = 1000..1e8, k = 0..100, D = 1..64

## A uniform DFT filter bank has M channels at sample rate s.

::: step
answer: s/M

### How far apart are the channels?
:::

::: step
answer: k*s/M

### Where is channel k centered?
:::

::: step
answer: s/D

### At what rate does each channel run if decimated by D?
:::

::: right
Right. D = M is critically sampled; D < M oversamples each channel to leave room for its filter's transition bands.
:::
:::

::: explain
## How can one FFT replace M separate bandpass filters?

::: model
Every channel filter in a uniform DFT bank is the same prototype lowpass multiplied by a complex exponential at the channel's center frequency, so each channel's output is a weighted sum of the same input samples with the prototype's taps, differing only in a phase rotation that depends on the channel and on the tap's position modulo M. Grouping the taps by that position, the polyphase decomposition, means each group can be filtered once and shared by all channels; what remains is to combine the M group outputs with the phase rotations of each channel, and that combination is exactly an M-point DFT. The heavy filtering is done once, at the decimated rate, and the FFT then fans it out into all the channels.
:::
:::

::: practice

::: check
given: s = 96 | 2000; M = 32 | 128
answer: s/M
unit: kHz
tolerance: 0.5%

## Channel spacing: {M} channels at {s} kHz?

::: misses
- [any] $f_s/M$.
:::
:::

::: check
given: N = 256 | 1024; M = 16 | 128
answer: N/M + log(M)/log(2)/2
tolerance: 0.5%

## Channelizer cost per input: N {N}, M {M}?

::: misses
- [any] $N/M + \frac{1}{2}\log_2M$.
:::
:::

::: check
given: s = 32 | 96; D = 2 | 6
answer: s/D
unit: kHz
tolerance: 0.5%

## Channel output rate: {s} kHz, decimation {D}?

::: misses
- [any] $f_s/D$.
:::
:::
:::
