Sampling & Aliasing
Another fundamental mathematical theorem in communication
engineering is Nyquist’s Sampling Theorem. Nyquist’s Theorem states that a
signal containing frequency components up to a maximum frequency of B Hz (in
other words the signal is bandlimited to B Hz), can be perfectly reconstructed
if it is sampled at or greater than 2B samples per second. Therefore, for an
audio signal with a maximum frequency component at 20kHz, this signal would need
to be sampled with a sampling frequency of at least 40kHz. In information theory
language, all the information in the signal is then contained in the sample
values and so the original signal can be perfectly recreated.
If you fail to sample at least as high as this frequency of
twice the highest frequency component then the samples will contain aliasing
products in the spectrum. Aliasing refers to the fact that the sampled values of
a sinusoid whose frequency is below the Nyquist frequency (half the sampling
frequency) are exactly the same sample values as would be found if a sinusoid
with certain other frequencies was sampled. That is, these other sinusoids are
aliases of the sinusoid whose frequency is below the Nyquist frequency, hence
the term. The following holds:
“When sampling at a rate of F_s samples/s, if k is any
positive or negative integer, we cannot distinguish between the sampled values
of a sinewave of f_0 Hz and a sinewave of (f_0 + k * f_0) Hz.”
[Understanding Digital Signal Processing, R. G. Lyons,
Addison Wesley, 1997]
Therefore, it is extremely important not to allow frequency
components with any significant power at frequencies above the Nyquist frequency
to be present in the sampled signal. To achieve this situation an analogue (it
has to be analogue) anti-aliasing filter is used to bandlimit the signal prior
to sampling.
Sampling consists of a “sample and hold” circuit
followed by conversion a digital code word, and is implemented using a chip
called an ADC (analogue to digital converter). For an audio signal, the output
of the ADC will be a code word which is a binary word whose number in binary
represents the amplitude of the sampled signal. A typical number of bits for an
ADC that is used to sample an audio signal will be 16 or 24 bits. This means
there will be 2^16 or 2^24 possible quantisation levels respectively. An ADC
used for audio would use linear quantisation which means that all the
quantisation levels are equally spaced. Because the digital sample values are
discrete there will be a small error between the actual analogue voltage and the
encoded amplitude. This error is called quantisation noise. Increasing the
number of bits of the ADC decreases the voltage difference between adjacent
levels (increases the resolution) and therefore the quantisation noise is
reduced. The maximum value of the quantisation error is equal to half the
voltage of the least significant bit. For a 16-bit ADC this value is only 2^-17
= 0.0008% of the full-scale voltage.
To reduce this even further you can use a dither signal
which is a higher frequency random signal that is added to the signal prior to
sampling. This signal modulates the value of the least significant bit and
produces a pulse width modulation signal, where the duty cycle of the pulse
(percentage of the time the pulse is high) is proportional to the value of the
voltage level above the lowest quantisation levels divided by the resolution
(i.e. the smallest quantisation step, or the voltage difference between 2
levels) of the ADC. When the signal is later reconstructed using a lowpass
filter after the digital to analogue converter (DAC), the filter integrates
(adds the contributions of) this pulse width modulation signal to reproduce
values closer to the original analogue sample values. This effectively increases
the resolution of the ADC and reduces the quantisation noise to below that which
would result if the dither signal was not added, i.e. the quantisation error is
reduced to below half the least significant bit and so the accuracy of the ADC
is increased.
The job of the ADC is to store the
amplitude value of the analogue signal as a digital number which is proportional
to the amplitude of the analogue signal voltage. This is called pulse code
modulation. As these numbers are in binary format the number of bits defines how
many discrete levels can be used. For an N-bit PCM codeword there are 2^N
different codewords, for example, if an 8-bit codeword was used then there are
2^8 = 256 discrete amplitudes and therefore discrete codewords that can be used.
A different type of ADC to this is the oversampling DAC.
This samples at a far faster rate than that used for the above type of ADC and
just uses the rule that if the signal is higher than the present sampled value
(which is fed back to an analogue comparator) then a digital 1 is output,
otherwise a digital 0 is output. In this way the ADC follows the amplitude of
the audio waveform because the ADC’s quantised step combined with the far
faster sampling frequency allows the fed back analogue value (produced by
converting the quantised value back to analogue using a DAC) to move faster than
the audio signal is able to. One of the benefits of the oversampling ADC is that
the noise spectrum is shaped so that the noise power is moved up in frequency
and the noise power in the band of interest, i.e. the audio band, is reduced in
power. The spectrum of the noise actually resembles an upside down cosine wave
with the noise starting at a lower power at DC and increasing in power as the
frequency increases, so the majority of the quantisation noise power that would
have resulted if a normal ADC had been used would be moved out of the audio band
and therefore the signal to quantisation noise power ratio (SNqR) is increased.
DAC & Signal Reconstruction
To reconstruct the analogue signal that was sampled by
the ADC and encoded as a sequence of PCM numbers, a digital to analogue
converter (DAC) is used in conjunction with a lowpass filter. The DAC does the
opposite to that which the ADC does. That is, it takes a PCM encoded number (for
example a 16- or 24-bit number) and outputs an analogue voltage that is
proportional to the value that the PCM number signifies. This analogue voltage
is then held constant by a sample-and-hold circuit so the analogue waveform
consists of a sequence of rectangular pulses all next to each other and with
different amplitudes. To finally reconstruct the original signal these
rectangular pulses are sent through a lowpass filter. This smooths the waveform
to produce exactly the original signal assuming a perfect lowpass filter.
Theoretically, the sampling of the original signal, followed by reconstruction
using a DAC and lowpass filter will perfectly reconstruct the original signal.
There will in practice be small errors because it is impossible to construct
perfect ‘brick-wall’ filters but it is possible to obtain a reconstructed
signal with a very small error.
|