Thursday, March 17, 2011

Pulse Code Modulation: Filtering and Sampling


In Digital Telephony, analog signals have to be converted into digital signals before transmission because of several advantages they have over Analog signals, one of which is their strong immunity against noise. Pulse Code Modulation (PCM) is one of the techniques to achieve the objective. Generally, PCM is a four step process consisting of Filtering and Sampling, Quantization and Encoding. However, Quantization may be performed either of two ways: Linear Quantization or Non-Linear Quantization. For Non-Linear Quantization, sometimes an additional step of Companding is performed after Sampling and before Quantization to prepare the samples for non-linear Quantization.
Here, in this post, we’ll discuss Filtering and Sampling. Later, in the next posts, we’ll discuss Linear Quantization, Quantization Error, Non-Linear Quantization, Companding and Encoding. Our discussion is based on digital telephony.

Analog Low Pass Filtering:
Before an analog signal is converted into digital one, it is passed through an analog Low-Pass Filter (see here). Following figure shows the frequency responses of a Low Pass Filter.


This filtering comes handy later to avoid aliasing when the analog signal is sampled and then reconstructed from the digital signal (see here), hence also called Anti-Aliasing Filter. In simple words, this is performed to filter out the frequencies which are higher than a “certain frequency”. We are interested in the frequency band lower than the “certain frequency” and not the higher.

 “Certain Frequency” is just a made up term for explanation and is not a technical term.

 For Telephony Systems whose main objective is to transfer human voice, that “certain frequency” can be found from high school physics. We have read human voice consists of frequency range of 300Hz to 3000Hz. Due to some constraints in designing an ideal filter, we make this certain frequency 4000Hz instead of 3000Hz. So after filtering, for the next step of Sampling, we know that bandwidth of the signal is 4000Hz i.e. the greatest frequency analog signal consists of is 4000Hz. 

Sampling
Sampling is the process of creation of a Discrete Signal by taking samples of an Analog Signal. These samples are taken at regular intervals; intervals may be time base (for time domain) or space based (for spatial domain) or any other independent variables. In our case, intervals are generally time based, these regular intervals define the sampling rate--the rate at which samples are taken, also called sampling frequency Fs.
Sampling is governed by Nyquist Sampling Theorem, according to which when a signal is sampled, the sampling rate (or sampling frequency) must be at least twice the highest frequency the signal contains, to avoid aliasing. In other words, sampling frequency must be at least twice the bandwidth of the signal. This means at least two samples are required per cycle of each frequency in the analog signal.
Therefore
                                                                Fs = 2 x 4000 = 8000 Samples/sec

Filtering and Sampling work in collaboration to overcome a possible artifact of aliasing which is a result of under sampling. Aliasing is an important concept to be understood and an important artifact to be overcome for correct transfer of voice data in telephony systems.
On the other hand, sampling rate, higher than minimum sampling rate of 8000 samples/sec, results in too much voice data to be transferred over the communication channel demanding a high bandwidth. Between the two extremes of under-sampling and over-sampling, above sampling frequency of 8K samples/sec is the threshold which is good enough for the reconstructed analog signal and is good enough for the usage of bandwidth.
A technique often used for sampling is Pulse Amplitude Modulation (PAM) in which a pulse is modulated with the filtered analog signal. This has been shown is the following figure created on Simulink Matlab, pink colored graph is the pulse, yellow colored graph is a sine wave to be sampled and aqua graph is the output of the PAM sampling.


Sampling creates discrete signals not the digitized signals; Quantization is the step to digitize the samples into binary encoded form.

7 comments:

Anonymous said...

gud stuff

Anonymous said...

Jazakallah khairan..May Allah continue to increase you knowledge. This is the clearer explanation of PCM i've come across so far. Thanks

Atif said...

Thanks everyone for appreciating!!!

azaz raja said...

Good work is don by you

azaz raja said...

hard work is don by you

Bille said...

Thanks, your explanation helped me a lot!

Unknown said...

good job Atiff :)
helps me a lot. a short and clear explanation!