Chapter Contents


5.0 Sampling


5.1 Codec

5.1.1 Frequency Response


5.2 Sampling

5.2.1 Aperture Error

5.2.2 Quantization Distortion

5.2.3 Aliasing


5.3 Video Codec

5.3.1 Aliasing

5.3.2 Quantization Noise

5.3.3 Overload


Assignment Questions


For Further Research



5.0   Sampling



The purpose of this brief section is to:

•   Examine the need for sampling

•   Observe the spectrum of a sampled signal

•   Examine the artifacts associated with sampling

•   Determine how sampling artifacts can be minimized


Some excellent applications notes on sampling are:

National Semiconductor - Intro to the Sampling Theorem

Harris - Windowed Sampling

Signals in the analog world are known as continuous signals. This means that they may have unique values at every instant in time. To accurately define them, we need infinite resolution in both time and magnitude.

Digital signals, those found inside of computers, are known as discrete signals. They have only finite values at specific instants in time. However, if the resolution and frequency of discrete signals is high enough, the average person cannot distinguish between them and continuous signals.

5.1             Codec

Coherent - Echo Cancellation

Versit - H320

Low Bit Rate Speech Coders by Cox et. al.

Codecs† convert analog signals such as voice or video into the discrete digital domain so that they can be handled as a data type. This allows them to be passed through modern digital exchanges, processed by computers, or digitally recorded. Codecs may also contain a number of control functions, but we shall ignore those for the moment and focus on the ADC† and DAC† paths.

5.1.1    Frequency Response

In order to digitize any signal, it is first necessary to determine the range of the analog signal to be digitized. The two principle attributes in audio signals are the range of frequencies, known as the passband or baseband, and the intensity or amplitude.

It should be remembered that the ear can hear a much wider range of sounds than the voice can produce. Thus, it is not easy to digitize voice and fool the ears. For example, persons talking on the phone sound like they are talking on the phone.


Approximate Passband

Sampling Rate


3.4 KHz

8 KHz

AM Radio

5 KHz


FM Radio

15 KHz


CD Player

20 KHz

44.1 KHz


The frequency and energy content of the source must be known in order to determine how many digitized samples and how much resolution is needed in each sample, to create a reasonable reproduction of the original sound.

It is interesting to note that some frequencies are more important than others in determining speech intelligibility. Ultimately, the two basic characteristics of voice power density and intelligibility, determine the bandwidth requirement. It has been subjectively determined that a frequency channel ranging from 300 Hz to 3400 Hz will allow a person’s voice to be recognized.

The above discussion also applies to other analog signals such as video. Video codecs however, digitize signals approximately a thousand times faster than audio signals.

Video signals are sampled at a much higher rate. In CCIR recommendation 601, the luminance signal is sampled at 13.5 MHz and the two chromance signals are each sampled at 6.75 MHz. Each component is then digitized with an 8-bit resolution.

5.2     Sampling

There are three primary sources of error or noise when sampling an analog signal:

·         Aperture error

·         Quantization distortion

·         Aliasing

5.2.1    Aperture Error

Distortion introduced by flat-topped sampling, cause loss of high frequency information. This is because the input signal may be changing while the sampled value is held constant. This error can be readily observed in the time domain.

Reducing the aperture width can reduce this error or noise.

5.2.2    Quantization Distortion

Quantization distortion is the difference between the sampled signal and its nearest digital equivalent.

The resolution or number of bits in the encoding process limits the number of different values an analog signal can have. It would take an infinite number of bits to perfectly encode an analog signal. Consequently, a quantization error or noise is introduced into the signal.

For an n bit code, there are a total of 2n-1 quantization steps. Consequently the instantaneous quantization error for an n bit DAC is:

The rms quantization noise is given by:         

A graph of this function resembles:     Companding

If the step size is constant, the signal to noise ratio due to quantization improves as the signal size increases. Companding is used to provide a more constant S/N over the entire range of signal levels. This means having small steps for small signals and large steps for large signals.

Passing the signal through a logarithmic amplifier and then digitizing can perform compression. However, performance that is more consistent can be achieved digitally.

The digital compression is performed in the ADC. An analog signal is digitized into 12 bits using linear encoding and compressed to 8 bits:

Compression can be performed as follows:

•   Step 1:        the 1st bit [sign bit] is left unaffected

•   Step 2:        determine the segment number: subtract from 7, the number of leading zero's in the 12-bit word [this forms the segment number and constitutes the next 3 bits of the compressed 8-bit word]

•   Step 3:        determine the step within the segment: copy the next 4 bits of the 12 bit word, into the next 4 bit positions of the 8 bit word

•   If there are more than 7 leading zeros, set the segment number to zero and copy the last 4 bits of the 12-bit word into the last 4 bit positions of the 8 bit word

Digital expansion occurs in the D/A converter section. The 8-bit word can be expanded to 12 bits as follows:

•   Step 1:        the 1st bit [sign bit] is left unaffected

•   Step 2:        the segment number is used to regenerate the number of leading zeros

•   Step 3:        the next 4 bits are inserted as is

•   If there are any more bit positions left in the 12 bit word, the next bit is set high, and all others are set low [since the last group of bits is not known, the mid value is chosen]

The consequences of this scheme are:

•   Segments 0 & 1 in the 12-bit word are accurately reproduced

•   Segment 2, which has 32 possible 12-bit codes, is compressed to 16, 8-bit codes

•   Segment 3, which has 64 possible 12-bit codes, is compressed to 16, 8-bit codes etc.

Companding Animation

There are two companding standards used for telephony codecs:

m-Law [North America]

A-Law [Europe]

A-Law and ΅-Law Curves


Notice that the segment progression [1, 2, 4, 8, etc.] can be implemented concurrently or consecutively. The North American ΅-law system uses a consecutive progression, while the European A-law uses concurrent

5.2.3        Aliasing

MXCOM - Switched Capacitor Filters

The sampling process creates a whole range of new signals. These new signals are the sum and difference frequencies of the input signal and all of the harmonics of the sampling signal.

The spectrum after sampling resembles:

Aliasing occurs when the lower sideband associated with the sampling frequency, overlaps the baseband spectrum. An aliasing frequency is generated if the sampling rate is less than double the highest frequency component in the baseband. Zooming in on this we obtain:

Besides creating tones, foldover distortion can create broadband aliasing noise.

Notice what happens in the time domain, if a signal such as a sine wave is sampled at less than the Nyquest rate:

A new lower frequency aliasing signal will be generated by the DAC at the output of the system. The DAC simply takes the samples it is given and attempts to reconstruct the original signal. In this case, it is not possible.

The amount of aliasing noise generated is a function of sampling rate, and baseband roll off. Limiting the frequency band prior to sampling can reduce Aliasing noise. These anti-aliasing filters are necessary at the DAC input. The higher the filter order [steeper the roll-off], the lower the aliasing noise.

Filter roll off occurs at integer multiples of 20 dB per decade. A two-pole filter for example, has a roll off of 2x20 or 40 dB per decade.

It should be evident that the theoretical minimum sampling rate is twice the highest frequency in the baseband. This is known as the Nyquist rate. In actual practice, the sampling rate is well above the Nyquist rate, or the antialiasing filters become too difficult to construct since they would require very high roll-off.

Mathematically, the filter slope or roll off can be expressed by the ratio:

This value always works out to 20 dB per decade per pole for simple filters.

In order to avoid using absolute values, and thus limiting the usefulness of this analysis, dummy variables are used to define the relationship between the maximum baseband signal, Nyquist rate, and sampling rate.

The sampling coefficient k represents the number of times the sampling frequency exceeds the Nyquist rate.

To find the amount of aliasing noise, one would normally integrate the roll off curve between 0 Hz and the maximum baseband frequency fm. However, this results in an infinity since a 0 occurs in the denominator of one of the expressions. For this reason, the integration limits must be changed to .

If we normalized the signal power S to 1, the signal to noise power ratio in dB is given by:

[Remember that although the S/N ratio for both power and voltage is numerically identical, the actual power level is proportional to the square of the voltage level.]

A plot of the aliasing noise as a function of the sampling coefficient and number of poles, resembles:     Decimation

One way to reduce aliasing noise is to oversample, and then discard most of the results. In the frequency domain we observe:

In the above illustration, the sampling frequency is 8 times that of the baseband cutoff, or 4 times the Nyquest limit. Thus, the aliasing noise is low.

In the time domain, oversampling a sine wave may resemble:

Since the sampling rate in this example is 8 times that of the highest baseband component, 3/4 of the samples can be discarded:

Although the sample rate is now at the Nyquest limit, the effective sampling coefficient is still 4. This improves the S/N ratio without the need for stringent baseband filters. Oversampling and decimation is one of the techniques used in audio CDs.     Continuous Time Oversampling

Up until recently, there has been no cost-effective, chip-level technique to synchronize audio, communications and video signals having different sample rates. CTO† developed by Analog Devices, addresses this problem.

CD players, DAT players, fax modems, digital telephones and video monitors use different digitization sample rates and standards. Even devices operating at the same rate will drift apart unless they are locked to the same frequency source. This technique re-samples and synchronizes modem, audio, and video data as required.

Incoming signals can be re-sampled at any rate between 4 and 54 KHz with a precision of 1 Hz. Samples can be moved in time, phase, and frequency on-the-fly, without degrading fidelity by means of the AD1843 SoundComm codec.

5.3             Video Codec

Analog Devices - Video Codec

Analog Devices - Bin Width Calculation

Digital - Video Codec

QuickTime Pro Datasheet

QuickTime 3

QuickTime on the Internet

H.261 & H.263 Video Codec by 4i2i Communications


Video codecs are much more complex than audio codecs, and can be implemented in either hardware or software. Audio codecs perform a simple one-dimensional amplitude compression while video codecs often perform a two dimensional spatial compression.

A digital signal degrades less gracefully than an analog signal. While digital information may in theory be duplicated an infinite number of times without any degradation, once that degradation does occur, it is very noticeable. A single bit error in the data stream could cause a large block of pixels to be displayed in a completely different color.

5.3.1    Aliasing

In most cases, aliasing will produced vertical lines in the picture. This can be reduced by applying a low pass filter to the video signal before it is digitized. This results in softer edges in the picture.

5.3.2    Quantization Noise

This occurs when the analogue waveform is quantized into a fixed finite number of levels. A 24-bit color picture (composed of an 8-bit value for each of the red, green and blue components of each pixel) suffers from virtually no quantization noise, since the number of available colors is 16.7 million. Reasonable results can be obtained from an 8-bits per pixel picture, especially if the picture is grayscale.

5.3.3    Overload

Overload is related to the finite number of levels that the signal can take. If a signal is too high in amplitude, then the picture will appear bleached. If the signal level of a grayscale image is too high, all levels above the maximum will be converted to white.

Another effect is wrap-around. This happens when out of range values are converted to the lowest value such as black.

Assignment Questions


Quick Quiz

1.     Aliasing is also known as [foldover, aperture, quantization] distortion.

2.     Quantization noise is a function of step [rate, size].

3.     In the following expression:


        The value k is the [number of poles, sampling coefficient, number of bits].

4.     In the following expression:

        The value n is the [number of poles, sampling coefficient, number of bits].

Analytical Problems

1.     Calculate the S/N ratio due to aliasing if the antialiasing filter rolls off at 40 dB/decade and the sampling rate is 2.4 times the highest baseband frequency

2.     A codec has the following characteristics:

8 KHz sampling

12-bit resolution for small signals

3.4 KHz cutoff frequency

4-pole antialiasing filter

        If the input is 1 Vrms full scale, determine:

a) Noise due to aliasing

b)    rms quantization noise

c) Suggest how the S/N could be improved.

Composition Questions

1.     Discuss how to avoid aliasing.

2.     What is decimation?

For Further Research


Audio CODECs


Video Codecs





†       COder DECoder

†       Analog to Digital Converter

†       Digital to Analog Converter

†       Continuous Time Oversampling