by Barry Van Veen
Earlier this year someone filed an income tax return using my identity. The topic of this blog post is aliasing, not tax fraud, although the concepts are similar. Aliasing in signal processing is when a sinusoid of one frequency takes on the appearance or identity of a different frequency sinusoid. Using false identity on a tax return is is a growing scam that could easily be prevented with more careful authentication.
Similarly, aliasing is always a possibility when sampling a signal, and simple measures should be taken to prevent it from occurring. Signals, given the opportunity, will always alias. This is not because they have malicious intent; rather, the reason lies completely in the mathematics of discrete-time sinusoids. This post explores the basic reason for aliasing and considers a few examples.
Why Does Aliasing of Signals Occur?
The fundamental reason for aliasing of signals is the fact that discrete-time sinusoids are not unique functions of frequency. Sinusoids of frequency and are identical for all integers . For example,
because the sample index is always integer valued. This property does not apply to continuous-time sinusoids because time is not limited to integers, but takes on a continuum of values. More on the properties of discrete- and continuous-time sinusoids is found in Sinusoidal Signals.
Hence, discrete-time sinusoids are only unique over a interval of frequency. Typically we work with the range of discrete-time frequencies . Aliasing of signals can occur when we sample - convert a continuous-time signal to a discrete-time signal. Continuous-time sinusoids with distinct frequencies are always unique. When sampling converts a continuous-time sinusoid to a discrete-time sinusoid, the discrete-time sinusoid does not inherit the uniqueness of its continuous-time predecessor.
Consider two continuous-time sinusoids, and . These sinusoids have distinct frequency and thus are distinct. However, if we sample them at intervals of seconds, then , while . The discrete-time frequency of and differ by and thus . We say that the sinusoid with continuous-time frequency rads/sec has aliased to the same discrete-time frequency () as the sinusoid with continuous-time frequency rads/sec.
Why is Aliasing of Signals a Problem?
If two (or more) distinct continuous-time sinusoids contribute to the same discrete-time sinusoid, we have no way of distinguishing the original continuous-time sinusoids. There is no way to determine the amplitude and phase to assign to the aliased continuous-time sinusoids if we are trying to analyze the signal or convert back to a continuous-time signal.
For example, if we observe that the amplitude of the discrete-time sinusoid at a particular frequency is 2, all we know is that the sum of an unknown number of continuous-time sinusoids produces an amplitude of 2. There are infinite combinations of continuous-time sinusoids that could sum to produce an amplitude of 2, and there is no way to uniquely determine their amplitudes.
Preventing Aliasing of Signals
The most common way to prevent aliasing is to limit the range of continuous-time sinusoids so there is a unique or one-to-one mapping between continuous- and discrete-time frequency. If we use the range for discrete-time frequency, then the corresponding range of continuous-time frequency is where is the sampling frequency in Hz. This result immediately follows from the fact that (see Sinusoidal Signals).
This leads us to the Nyquist Sampling Theorem, which states that there is a unique correspondence between discrete- and continuous-time sinusoids - no aliasing - if the sampling frequency is chosen to exceed twice the highest continuous-time frequency present in the signal. In this case one can uniquely reconstruct the continuous-time signal from its samples.
In practice the presence of noise and interference typically makes it impossible to know in advance the highest frequency present in the continuous time signal. A continuous-time low pass filter is applied to the data before sampling to limit the bandwidth to a desired range. This is called an anti-aliasing filter.
Examples of Aliasing
Below are two examples where you can both see and hear aliasing.
The first example is a saxophone playing the note 'A'. The spectrum of this note, shown in Figure 2, exhibits spectral peaks at harmonics, i.e., integer multiples, of 440 Hz. The amplitude of the harmonics is quite small above 4 kHz. (The spectral peak near 0 Hz occurs at 60 Hz and is due to powerline noise contaminating the recording.)
We sample this signal at 2756 Hz with and without an antialiasing filter. At this sampling frequency the maximum continuous-time sinusoid frequency that can be represented without aliasing is 1378 Hz. Thus, the antialiasing filter limits the signal to the first three harmonics. The third harmonic occurs at 1320 Hz. Figures 3 and 4 depict the spectrum of the sampled sound with and without the antialiasing filter applied before sampling.
The aliased fourth, fifth, and sixth harmonics are labeled in Figure 4. The spectral peaks at 324 Hz and 764 Hz are aliases of the seventh and eighth harmonics. Note that in general a sinusoid of frequency aliases to and where are integers. This is discussed in greater detail in Fourier Transform Interpretation of Sampling.
A wind instrument like a saxophone creates a very tonal sound because the only significant contributors are harmonics of the fundamental. Aliasing introduces energy at frequencies which are not harmonically related to the fundamental, and introduces a muddy character to the sound, or a buzzing aspect. You can hear the difference in the clip below. The first portion of the clip has no aliasing and corresponds to the spectrum in Figure 3, while the second portion of the clip has aliasing as shown in Figure 4.
Saxophone sampled at 2756 Hz with no aliasing and with aliasing.
Egmont Overture Finale Segment
The second example of aliasing is from a segment of the Egmont Overture ("Egmont Overture Finale" Kevin MacLeod (incompetech.com) Licensed under Creative Commons: By Attribution 3.0 http://creativecommons.org/licenses/by/3.0/). As in the saxophone example, the original piece was sampled at 2756 Hz with and without an appropriate antialiasing filter. The spectrogram (frequency vs time) of the sampled signal with no aliasing is shown in Figure 5. The spectrogram of the sampled signal with aliasing is shown at the top of the post in Figure 1. There is relatively little aliasing evident in the first 6 seconds of the segment due to most of the energy being at low frequencies. However, there appears to be a lot of aliasing in the final 6-7 seconds as Figure 1 has a lot more high energy (red) components present than Figure 5.
If you listen carefully, you can hear the distortion introduced by aliasing in the last portion of the clip when the strings and piccolo sustain the high notes (listen for the timpani). Note that the piece sounds rather dull, even without aliasing, because of the low sampling rate only results in frequencies up to 1378 Hz to be produced.
Egmont Overture segment sampled at 2756 Hz with no aliasing.
Egmont Overture segment sampled at 2756 with aliasing.