Here one tone, , is split into a low band and a high band, each band keeps every 2nd sample, and the two are rebuilt and added. Watch the lines at 0.70π: each band has an alias there, but in the sum they cancel.
Two bands, two aliases that cancel
cos(0.30πn) through a two-channel db2 bank: split, keep every 2nd, rebuild, add.
The two db2 filters: at 0.30π the low one's gain is 0.94 and the high one's 0.33; they cross at 0.5π.
Describe this picture
Four stacked strips against Ω from 0 to π rad/sample, for through a two-channel db2 bank. The first shows the two filters’ gains, from 0 to 1.1: as a solid curve labelled “low” and as a dashed one labelled “high”. At 0.30π they are 0.94 and 0.33, and they cross at 0.5π. The next three strips, “low band, rebuilt”, “high band, rebuilt” and “sum”, show amplitude from 0 to 1.1. In each the tone is a line at 0.30π with a dot at its top, and the alias a line at 0.70π with an open ring, marked ”+” or ”−” for its sign. The readouts are the alias in the low band, in the high band and in the sum, to 3 decimals. The strips fill in turn. The low band holds the tone at 0.890 and an alias of 0.313, and the high band a tone of 0.110 and an alias of 0.313 with the opposite sign. Last the two alias lines slide into the sum and wipe each other out: the tones add to 1.000, the alias reads 0.000, and the output is the input 3 samples late. After the clip a slider named “High-band gain” scales the high band by from 0 to 1, and the caption reads like “High band × 0.50: 0.156 of alias is left, and the tone is 0.945.”
Two bands, two aliases that cancel
An audio coder spends few bits on the bands you hardly hear and more on the ones you do. To do that, it first splits the sound into bands. This page is about splitting a signal into bands and putting it back together, without losing anything.
A bank of filters that splits a signal is an analysis bank. Here it has two filters: a low-pass and a high-pass . Each band now holds about half the frequencies, so by Downsampling and decimation (22.1) it can keep every 2nd sample. I write that step as ↓2.
The two bands together then have as many samples per second as the input had. A bank that keeps the total rate the same is critically sampled. Nothing is wasted, and that matters when every sample costs bits.
The synthesis bank goes back. Each band is upsampled with a zero after every sample, as in Upsampling and interpolation (22.2); I write that as ↑2. Then each band goes through its own filter, or , and the two are added.
There is a catch. A band is not cut off cleanly at , so by 22.1 keeping every 2nd sample aliases. Let’s see exactly what ↓2 followed by ↑2 does. It keeps the even samples and puts zeros at the odd ones, so it multiplies the signal by
which is 1 for even and 0 for odd .
Properties and the inverse z-transform (16.2) showed that multiplying by turns into . With , has the transform . So the pair ↓2, ↑2 turns into
On the unit circle, , so is the spectrum slid by . That is the frequency shift of the section “Slide the spectrum round the circle” in Properties of the DTFT (12.3).
Try it on one tone. Since , the pair turns into . Half the tone stays, and half of it appears at , where there was nothing. That new line is the alias.
Now follow both bands through the bank. The low band is before ↓2, and after ↑2 and it is . The high band is the same with 1 in place of 0. Add the two and sort the terms:
with
is the distortion transfer function. It acts on the signal itself, like the of Transfer functions, poles & zeros (16.3). is the alias transfer function, and it acts on the slid copy .
So each band has an alias term of its own. But we choose and , so we can make the two bands’ aliases cancel: . That is aliasing cancellation.
If, as well, , the output is the input delayed by samples. That is perfect reconstruction.
The pair I’ll use is the Daubechies pair of 4 taps, called db2. Its low-pass taps are
The high-pass reverses them and flips every other sign, , which gives −0.12941, −0.22414, 0.83652 and −0.48296. The synthesis filters are the two reversed: and .
The taps of add up to , so its gain at is , not 1. The picture at the top of the page divides both gains by , so that each pass band reads 1.
That picture sends one tone, , through this bank. It shows each band rebuilt on its own, and then their sum.
Notice that the alias is not small in either band: 0.313 of a tone of size 1. It is only the sum that is 0.
It is like two clerks who copy the same column of figures. One writes a figure 5 too high and the other writes it 5 too low. Each copy is wrong, but their sum is right.
After the clip, use the slider to scale the high band by a gain from 0 to 1, as an equaliser would.
The tone in the sum is the low band’s 0.890 plus times the high band’s 0.110. The alias is , because only the fraction of the high band’s alias is there to cancel the low band’s. Try 0: the alias is back to 0.313, and the tone is 0.890.
So the cancellation is a balance. Process one band, and part of the alias comes back. An audio coder that stores one band more coarsely than the other pays this price too.
Why the aliases cancel
Reversing the taps of a filter turns into : put in and it becomes . The reversed 4 taps then need a delay of 3 to start at again, a factor . So and . Put in the transform of and you get
Put that into the two terms of :
They are equal and opposite for every , so . That holds for every tone, not only 0.30π.
On the unit circle, is times the conjugate of , because the taps are real (12.3, “The rules that carry over”). So there is . Daubechies chose so that at every , and then .
That is why the tones in the instrument, 0.890 and 0.110, add to 1.
The simplest such pair is the Haar pair, and . It has 2 taps, so its delay is 1 sample. Its split is gentle: at 0.30π its low and high gains are 0.89 and 0.45. So each band’s alias is bigger, 0.405 at this tone, and the two still cancel.
The name QMF, quadrature mirror filter, comes from an older and simpler choice: , so the high-pass is the low-pass slid by . With and , the alias term is . The aliases cancel here too.
But perfect reconstruction fails. Split into its two polyphase components, as in Polyphase structures (22.4): . Then
For an FIR filter that is one delay only if and each have a single tap. So the classic QMF reconstructs perfectly only when has 2 taps, as Haar’s does. Longer QMF designs, such as Johnston’s, get close and accept a small ripple in .
There is a cost to db2 as well. Its taps are not symmetric, so by the section “Why symmetric taps give a straight phase” of Linear-phase systems (17.3), its phase is not a straight line. Among pairs built the db2 way, only Haar has symmetric taps. Banks that need a straight phase use different filters for analysis and synthesis, called biorthogonal pairs.
The maths behind it · orthogonal matrices
An orthogonal two-channel bank such as db2 is an orthogonal matrix. Its rows are copies of and shifted by 2 samples, and each row has length 1 and is perpendicular to every other. Synthesis is the transpose, so reconstruction is . The DFT bank of the next section is the DFT matrix of The DFT as a matrix (13.5), with a window in front.
One prototype, eight channels, a perfect sum
Two bands are often not enough. A uniform bank splits the band from 0 to into equal channels. The easy way to make it uses one low-pass, the prototype , and shifts it to each centre.
By 12.3, multiplying by slides a spectrum by . So channel has the taps , centred at . This is a DFT filter bank: the arrows are the ones in the DFT.
My prototype is a Hann window of 16 samples, the periodic one of Inverting the STFT (15.6). It is scaled so its taps add to 1, so its gain at is 1: . With , the channels sit apart.
These eight channels are the STFT of Spectrograms & the STFT (15.5) in disguise. Channel ‘s output at sample weights the 16 samples ending at by the window and by an arrow turning at , and adds them. That is one cell of the STFT of the section “A row of short spectra”, at frequency . Its window is back to front, its frame ends at , and only an arrow of size 1 in front differs.
One prototype, eight channels, a perfect sum
A 16-sample Hann low-pass shifted to the centres 2πk/8, k = 0 to 7.
The prototype, channel 0: a 16-sample Hann window used as a low-pass, gain 1 at 0.
Describe this picture
One panel: gain from 0 to 1.15 against Ω from 0 to 2π rad/sample, for a 16-sample Hann low-pass shifted to the centres 2πk/8, k = 0 to 7. Each channel’s gain is a thin curve labelled “k = 0” to “k = 7” at its peak. The line styles cycle through solid, dashed, dotted and dash-dot, so channels and share a style. The readouts count the channels and give their complex sum. The clip draws the prototype, channel 0, with gain 1 at 0, then channels 1 to 7, each shifted by 2π/8 = 0.25π from the last. Each channel is 1 at its own centre, 0.5000 halfway to the next, and 0 at the next centre. Last a thick solid line labelled “all eight added” draws at gain 1 everywhere, and the sum reads “a delay of 8 samples”.
Watch the thick line at the end: added as complex numbers, the eight channels are exactly a delay of 8 samples, so nothing is lost.
Notice that the channels overlap: the magnitudes of the eight gains add to between 1.0000 and 1.0620, not to 1. Added as complex numbers, with their phases, they give exactly 1 at every .
It is like eight spotlights on a stage. Their beams overlap, but added together they light the stage evenly.
Why exactly a delay? Add the taps of the eight channels:
When 8 divides , every arrow is 1 and the sum is . Otherwise the eight arrows are equal steps round the circle, and they add to 0, as the roots of unity did in Complex numbers for signals (3.3).
So the sum keeps only and , times 8. The Hann window is 0 at and 1 at , and . The eight channels add up to , a delay of 8 samples.
This is the arithmetic of the section “Windows that add up to a constant” in 15.6, with time and frequency swapped. There, copies of a window shifted in time added up to a constant. Here, copies of its spectrum shifted in frequency add up to a pure delay.
In the instrument every channel runs at the full rate, so there are 8 times as many samples as in the input. A practical bank keeps only every 8th output of each channel, which makes it critically sampled. Then it does not run 8 filters: it runs the 8 polyphase components of at the low rate and one 8-point FFT (22.4).
The MDCT
Audio codecs use a critically sampled bank called the MDCT, the modified discrete cosine transform. Each block makes new coefficients from new samples, so nothing is added to the rate. But each block’s window is samples long, so neighbouring windows overlap by 50 %. It uses cosines in place of the DFT’s complex arrows.
Taken alone, one block cannot give back its samples from coefficients: what it returns is aliased in time. Where two neighbouring blocks overlap, their aliases are equal and opposite, and overlap-add, as in 15.6, cancels them. This is time-domain aliasing cancellation, the twin of the first instrument with time in place of frequency.
AAC uses blocks of 1024 coefficients, with windows of 2048 samples. MP3 first splits the sound into 32 bands with a polyphase bank, then takes an MDCT with 18 coefficients in each band: 576 lines. Opus and Vorbis use the MDCT too.
Worked example
Let’s redo the page’s numbers by hand, from the filter gains.
1. The db2 bank at 0.30π. In the filter strip’s units the gains are 0.94344 (low) and 0.33156 (high) at 0.30π, and the other way round at 0.70π. The tone goes through and then at 0.30π, so the low band’s tone is and the high band’s .
The alias goes through at 0.30π and at 0.70π. So both bands’ aliases are , with opposite signs. The tones add to 1.000, the aliases to 0, and the output is the input 3 samples late.
2. Processing breaks the cancellation. Scale the high band by . The alias left is , and the tone is .
3. The Haar pair at 0.30π. Here and . Each band’s alias is , and the tones are 0.794 and 0.206, adding to 1.
4. The DFT bank. The sum of the eight channels’ taps is at and , and 0 elsewhere. With and that is . The magnitudes of the gains add to between 1.0000 and 1.0620.
5. In code. pywt.Wavelet('db2') in PyWavelets holds the four filters. Its rec_lo is as written here and rec_hi is ; dec_lo and dec_hi are the same taps reversed. scipy.signal.upfirdn(h, x, 1, 2) filters and keeps every 2nd sample in one call.
Where you’ll meet this
Filter banks are inside audio coders (MP3, AAC, Opus), equalisers with many bands, and hearing aids, which adjust the gain band by band. Some echo cancellers work band by band too, at a low rate in each. Software radios use DFT banks to pull many channels out of one wide band at once; they call them channelisers.
Split the low band again, and again, and you get the wavelet transform of Wavelets (23.2), built on the db2 pair of this page. How a codec decides how many bits each band gets is Perceptual audio coding (29.3).
The maths behind it · multiscale analysis
Splitting a time series into bands and studying each one is sub-band, or multiscale, analysis. Because an orthogonal bank keeps energy (Parseval), the variance of the series can be shared out among the bands.
Reference card
| Quantity | Formula | Notes |
|---|---|---|
| Two-channel bank | analysis: , ↓2; synthesis: ↑2, , add | |
| Distortion term | acts on | |
| Alias term | acts on , the spectrum slid by | |
| Aliasing cancellation | the two aliases equal and opposite | |
| Perfect reconstruction | also | db2: ; Haar: |
| Orthogonal pair | , | taps; Daubechies; not linear phase beyond Haar |
| Classic QMF | aliases cancel; perfect only with 2 taps | |
| DFT bank | channel : | an STFT; a 16-sample Hann with adds to |
| MDCT | coefficients per samples, windows of | 50 % overlap; AAC, MP3, Opus, Vorbis |