Tuesday, August 2, 2011

Analog to Digital (and Digital to Analog) with CODECs

In this post I continue to discuss the (rapidly disappearing) Public Switched Telephone Network (PSTN).
CODECs are used to convert analog signals to digital signals on one end and, on the other end, convert a digital signal back to an analog signal.


 CODEC Conversions

CODECs use a method called Pulse Code Modulation (PCM) to convert the analog signals to digital bit streams. PCM uses a technique called sampling to obtain instantaneous voltage values at specific times in the analog signal cycle. This sample generates a Pulse Amplitude Modulated (PAM) signal.

PAM Signal Generation

The diagram above shows an analog signal multiplied with a digital pulse train instantaneous point by instantaneous point with the result being a PAM wave representation of the analog waveform. The digital pulse train determines the sampling rate and it is easy to see if the analog signal is not sampled enough, the analog signal will not be properly represented by the PAM signal. 

In 1924 while working for AT&T Henry Nyquist studied this sampling technique and developed the Nyquist Sampling Theorem. This theorem states that an analog signal can be uniquely reconstructed, without error, from samples taken at equal time intervals if the sampling rate is equal to, or greater than, twice the highest frequency component in the analog signal or:

Sampling Rate = 2(BW)

Example
The Public Switched Telephone Network (PSTN) has a bandwidth of approximately 3300 Hz. Using the Nyquist Sampling Theorem calculate the minimal sampling rate of the PSTN.

Solution
Sampling Rate = 2(BW) = 2(3300 Hz) = 6600 Samples per Second

This means, for minimal analog to digital conversion, an analog voice telephone line must be sampled minimally 6600 samples per second. Sampling at a rate of less than 6600 samples per second will not reproduce the signal properly.  Sampling rates of greater than 6600 samples per second will produce more detail. Designers of the voice network used Nyquist’s Sampling Theorem to determine the proper sampling rate. They knew they could not sample under the 6600 samples per second rate and also knew going over the 6600 samples per second rate would produce higher quality. A PCM sampling rate of 8000 samples per second was selected.

In my next post I'll discuss Quantization, which is used along with the sampling rate to generate a PCM wave.

No comments: