Sie sind auf Seite 1von 16

Rasaki Badaru

Pulse Code Modulation and Companding

(Voice Communications TEL500) (Fall 2010)

Supervised by: Prof. John Marsh

Written by: Rasaki Badaru

Introduction Companding

Rasaki Badaru The project is to demonstrate the process of digitization of analog voice signal using Pulse Code Modulation process. To perform this demonstration, spread sheet application is used to simulate voice signal to be used, define and compute various functions used at different stages of the process demonstration. The graphical function of the program is used to depict visual comparison and analysis of results from the demonstration. Pulse Code Modulation is the process of converting analog voice signal into digital form that can be easily transmitted using either digital or analogue transmission method. The PCM process starts with a sampling stage that discretized the analog voice signal into a series of sampled values that is quantized based on a predefined interval. The quantized values are then converted to binary digits to form a digitized signal that is transmitted. The digitized signal is easier to multiplex and less susceptible to noise problem than the original signal. Companding is an intermediary processing stage that is used to optimize the PCM process. It is a technique that transforms a given raw analog signal into an intermediary form that is more suitable for sampling when the original signal composes of both low and high signal power. Companding is carried out in two stages, compression and expansion. The original signal is first compressed using a specific companding algorithm. The compressed output signal is sampled and quantized and then expanded back for reconstruction. Companding is used to avoid poor quantization of signal with low power content. This prevents loss of data and misrepresentation of information.

Rasaki Badaru

Procedure
The spread sheet application is used to define a sine wave to be used as a working analogue voice signal. It is a time varying function with the time range of 0ms to 200ms with a step of 1ms with amplitude of 1. Though for some certain section in the lab, the amplitude of the voice signal will be varied in step of .05 at some stage of the lab. The sine wave signal is used as the best representative of an analog voice signal because it has a similar characteristic features. The sine function to be defined is as followed: yt=A*sin(2ft+ ) , where A is the amplitude, f is the frequency and t is the time with phase angle that is always equal to zero. For the time range, the signal level of the analog voice signal will be computed and stored in a cell column. The signal level, ranging from -1 to 1, will be mapped onto a new interval based on a mapping function that will be defined in the spread sheet. This mapping process is analogous to the sampling stage of the PCM. Two forms of mapping will be performed: static and variable range mapping. In the static range mapping, the upper and lower bound of the mapping function are specified as number values while in the variable range mapping, the lower bound of the mapping function is set to 0.5 while the upper bound value is based on a function N+0.5 with variable N. The values from the mapping process will be the new signal levels that will be processed to a digitized voice signal. The next stage of the exercise is a companding process that is introduced to enhance the sampling signal for a much better sampling points. Mu law companding algorithm will be used in the exercise. The process is in two stages: expansion and compression. The mu-law compading composes of compression and expansion functions that are defined with the inbuilt functions of the spread sheet. The computed values from the compression function will now be used for the PCM process and the final quantized values are expanded with the expansion function to form the signal levels for digitized signal. The computed results in various columns will be used to investigate the digital voice signal vis-a-vis the analog voice signal. Some of the properties to be investigated are amplitude effect on quality of a digitized signal, signal-to-quantized noise ratio (SQR), the sampling bit depth and the companding practice. Graphical plots of the various column results will be drawn to give a pictorial analysis of the process and comparison.

Rasaki Badaru

Pulse Code Modulation


The signal power of analog voice signal attenuated during transmission. The loss of power makes it very impossible to detect the attenuated signal level in a very noisy situation. In order to boost the analog signal power, amplifiers are used at some predefined interval along the line of transmission. However, the amplifier does not only increase the signal, but also increases the noise content of the transmitting signal. Also, analog signal transmission is known to be prone to noise generated in the transmitting line and environment. When the signal source is very far away from the receiving end, the noise power that builds up along the line of transmission could rise to an equal level to the transmitting analog signal. Because of this, the signal level will be hard to detect and the information with the signal is misinterpreted. The noise content is very difficult to remove from the transmitting analog signal and the only alternative to counteract the build up noise is to increase the signal. But this approach as mentioned above compromised further the fidelity of the transmitting analog signal. Because of the problems associated with the analog voice signal transmission, a digital voice transmission is developed. In digital voice transmission, the transmitting analog voice signal is converted to a digital form that is transmitted instead. Instead of a continuous rise and fall of signal level found in analogue voice signal, the digitized voice signal has a signal level that is discretized in time and value represented with binary digits. The digitized voice signal is less prone to noise compare to analog signal because the signal levels in the form of the binary digits can always be replace with signal power that will always be above the prevailing noise power. Thus, digitized voice signal is inherently immune to noise that builds along the line of transmission. Also when noise builds up in the transmitting digitized voice signal, it does so evenly across the spectrum of the transmitting signal as an additive to the signal level whereby the actual signal level can easily be recovered. During a long distance transmission that attenuated the transmitting digitized voice signal power, repeaters are used to amplify the transmitting digitized voice signal. Amplification is done by reconstructing the digitized signal. The process involves extraction of unwanted signal contents and rebuilding of the transmitting digitized signal. Unlike the analogue amplification process that amplifies both the noise and the signal levels, the digital signal is amplified without the noise content. Because of inherent immunity to noise, clean signal amplification and flexibility to

Rasaki Badaru multiplex, voice signal is predominantly preferred to be transmitted in digitized form. Pulse Code Modulation process is used to transformed analog voice signal into digitized voice signal. It is implemented in three stages: sampling, quantization and coding. The sampling stage is a very important part of the process because it forms the signal elements that determine the quality of digitized voice signal that is generated at the end of the process. Sampling rate is the amount of sampled values from the analog signal level taken in a second. It determines the quality of the voice signal reconstructed from the sampled values. Based on Nyquist theorem, the sampling rate must be twice the highest frequency component of the analog signal for reconstruction of signal to be free of alliance effect and be of good quality. It is the minimum optimal rate for sampling. The analog voice signal consists of a frequency range between 0 Hz to 4 kHz that combines together to form the continuous analog signal in the time domain. At a rate twice the highest frequency component - 4 kHz - sample values of the voice signal are taken for digital transformation. Thus, the ideal sampling rate for voice signal is 8 kHz. The sampled values at this rate will yield a good reproduction of the original signal. However, far more voice reproduction could be achieved with sampling rate above 8 kHz. Thus, the sampling stage discretized the analog voice signal in time with series of continuous sampled at the rate 8000 samples per second. To ensure that the sampled values are always above the noise level, each of the continuous value is mapped onto an integer interval to form discrete set of value. This mapping process is known as quantization. During the quantization process, a mapping function is used to map each sampled value to a nearest integer in a predefined interval. The mapping function is many-to-one type of function; more than one continuous sampled value could be mapped onto an integer. At the end of the process, new set of values called quantized values are generated. These values are discrete in time and in value unlike the sampled that is only discrete in time. Due to the fact that some of the sampled values are rounded up to an integer, the signal reproduce from the quantized values are less in dynamism when compared to the one from sampled values. In order to minimize the effect of this rounding off, the range of the mapping interval is always chosen to be as high as possible. The number of possible mapping that can be done within an interval is referred to as quantization levels. The next step taken is the representation of each quantized values with equivalent binary digits in 1s and 0s. Equal number of binary digits is used to represent each quantized value and the number digits represent a binary number is referred to as the bit depth. The higher the quantization levels the more the bit depth. The two digits constituting the binary number are indicated with two distinct

Rasaki Badaru voltage levels that are always chosen to be above noise level. These series of bits represented with voltage level form the digitized voice signal. The steps above analyze the PCM process of converting analog voice signal to a digital signal with the assurance of having a signal power above the prevailing noise. By this, the transmission of the signal is done with the assurance of power that is always above the noise level. The quality of the digitized signal is dependent on both the sampling rate and the quantization levels. As mentioned earlier, the minimum requirement for sampling rate is the rate that is twice the highest frequency component of the analog voice signal and the quantization levels, though has no minimum requirement, but must always be kept to an optimum number that minimizes the loss of dynamism in the digitized voice signal. The sampling rate and quantized level are always kept to the optimum minimum in order to reduce the cost of transmission. When the two parameters are set as low as possible, less number of bits are generated for transmission. Likewise, the higher the sampling rate, the more the sampled values to be quantized and therefore, there is need for large quantization levels in order to minimize the loss in dynamism. Thus more bits are needed for transmission of a single quantized value of the digitized voice signal. For an optimum digitized voice signal, the sampling rate of the analog voice signal is kept at 8 KHz with quantization levels of 256 with 8 bit depth. As a result of this, digitized voice signal is transmitted at the rate of 64 Kbps that forms the DS0 signal. The lab experiment is used to demonstrate the PCM process and the effect of changing parameters at different stages of the process on generated digitized voice signal. The following result below provides explanation with diagrams from the lab exercise. Strong signal with large quantization levels: In Figure 1.1 below, the original signal amplitude is 1 and the quantization levels is 128; the digitized voice signal generated from the PCM process has a high fidelity because there is large number of possible integer values that the sampled values could be mapped onto. Due to this, there is a great dispersal of sampled values among the integers thereby creating a good dynamic range in the digitized voice signal generated.

Rasaki Badaru
1.5 1

0.5

e d u t p m l a n g i s

-0.5

-1

original signal digitized signal

-1.5 0 0.05 0.1 time[s ] ec 0.15 0.2

Figure 1.1 Strong signal of amplitude 1 with large quantization levels of N = 128 Weak signal with large quantization levels: In the Figure 1.2 below with sampling level remained the same as above but with low amplitude of 0.1, the fidelity of the digitized voice signal generated is not as much as it in the strong signal above. However, the quality of the voice signal reconstructed from this digitized voice signal is good enough to hearing due to large quantization levels. Thus, the quality of a digitized voice signal is dependent on the strength of the original signal and large quantization levels is more appropriate to be used when original signal power is low.
0.15

0.1 0.05 0

n g i s e d u t p m l a

-0.05

-0.1 -0.15 0

original signal digitized signal 0.05 0.1 time[s ] ec 0.15 0.2

Figure 1.2 Weak signal of amplitude 0.1 with large quantization levels of N=128.

Rasaki Badaru In the two previous observations, the quantization level is high enough to yield a reasonable good digitized voice signal at a low signal power of the original analog voice signal. The next two studies show how the quality of digitized voice signal differed from one another when quantization level is low at different amplitudes of original signal power. Strong signal with low quantization level: In Figure 1.3 below, the signal power is low with quantization levels of 8 to give the digitized voice signal that is superimposed on the original signal as in the image. It can be seen that the quality of the digitized voice is barely good enough to replace the original signal with loss of quality. Though the quality of sound from this process might be impaired but not to the point of not being intelligible to hearing. Thus, it is important that the original signal power be high enough in order to get a good digitized voice signal. However, at a low analog signal power with a large quantization levels, a digitized voice signal that is good enough to hearing can still be generated.
1.5

0.5

e d u t p m l a n g i s

-0.5

-1

orig inal sig nal dig itizedsig nal

-1.5 0 0.05 0.1 tim [s ] e ec 0.15 0.2

Figure 1.3 Strong signal amplitude 1.0 with low quantization levels of 8 Low signal with low quantization level: When a low analog signal power is quantized with few quantization levels, the process yields a very poor digitized signal that barely resemble the original signal as depicted in Figure 1.4 below. The digitized voice signal is completely different from the original signal. It is impossible to reconstruct the voice signal from such digitized signal. The digitized signal is almost a square with just only two signal levels. This form of digitized signal is a complete distortion of the original signal. Unlike the case above that has low amplitude but still yield a reconstructable digitzed voice signal, this is completely out of order. Thus, it is important that the quantization levels should be as high as possible when the signal power is too low.

Rasaki Badaru
0 5 .1 0 .1 0 5 .0 0 -0 5 .0 -0 .1 -0 5 .1 0 0 5 .0 0 .1 t e[ e ] im s c 0 5 .1 0 .2

e d u t i p m l a n g s

o in l sig a rig a n l d itiz dsig a ig e nl

Figure 1.4 Weak signal of amplitude 0.1 with quantization levels of 8. As demonstrated in the plots above it can be seen that at a constant sampling rate, the quality of the digitized voice signal is dependent on both the quantization levels and the original signal power.

Companding
When the transition rate of analogue voice signal is highly non-uniform from point to point, certain segments of the signal range tend to be quantized at a disproportionate level. In such a situation, a high dynamic range region is likely to be quantized with more levels while the low rate region is inadequately quantized. This situation leads to misrepresentation and low quality of the voice signal in a digitized form common with sampling done a linear scale. To avoid this situation, a different approach that adequately sampled every segment of the signal is introduced. The common technique used in handling this situation is companding. It is a process that transforms a given analog signal into an intermediate form which can be sampled to yield adequate sampled values for every segment during digitization of the original signal. During the process, the analog signal is compressed at one point and expands at the last stage. The process ensures that high priority is given to the low energy portion of the signal during the sampling process with a minimal sampling preference to the high energy portion.The two main companding techniques used are A-law and the mu-law. The A-law compading is commonly used in Europe and other part of the World while the -law companding is used in United States and Japan.

Rasaki Badaru The -law companding is based on a logarithmic functions used to compressed and its inverse that expands the processed signal. The two functions are defined as followed: Compression function, y(x)=sgn(x)*ln1+xln1+ , level that -1 x1; where x is the analog signal

forms the input into the compression function. Expansion function, y-1(y)=sgn(y)* 1*(1+)|y|-1 , -1 y1; where y is the quantized

value from the compressed PCM process. The mu parameter determines the quality of the digitized signal derived from the process; the most commonly used parameter number for mu is 255. The following results from the lab illustrate how mu-law companding improve s the quality of digitized signal even at a very low signal power when the mu parameter is set to 255. Strong signal and large sampling levels: With mu parameter of 255, Figure 2.1 shows the result of the digitized signal when companding is used. It can be seen from the plot that the less dynamic region of the original signal is more represented with quantized levels than the high dynamic sections. Also the quantized values are lower in range and less dense when compared to the initial result in Figure 1.1. Due to this, the digitized signal based on companding has less bits to be transmitted and this reduces the cost of transmission. However, the digitized voice signal reconstructed is less in quality when compared to what is obtained from Figure 1.1 above.
15 .

05 .

e d u t p m l a n g i s

-05 .

-1 -15 . 0

o in l s n l rig a ig a d it e s n l ig iz d ig a 00 .5 01 . tm [ e] i es c 01 .5 0 .2

Figure 2.1 Strong signal of amplitude 1.0, 256 quantization levels with mu parameter of 255

Rasaki Badaru Weak signal and large sampling levels: The companding effect is more pronounce on weak signal than in the strong signal. This is illustrated in the Figure 2.2 where the digitized voice signal has almost the same signal reconstruction quality as when in strong signal. This happens because the dynamic rage of the weak signal is less and as such, the companding process tends to compensate for this less off energy content with high density distribution of sampling point across the whole signal range. Based on the same reason, the digitized voice signal derived from companding is better representation of the original signal the digitized voice signal from Figure 1.2 above with no companding. Thus, there is a great improvement in quality of digitized signal derived from weak signal when companding is used.
0 5 .1 0 .1 0 5 .0 0

i s e d u t p m l a n g

-0 5 .0 -0 .1 -0 5 .1 0 0 5 .0 0 .1 t e[ e ] im s c 0 5 .1 0 .2

o in l sig a rig a n l d itiz dsig a ig e nl

Figure Figure 2.2 Weak signal of amplitude 0.1, large sampling level with companding muparameter of 255. Strong signal with low sampling levels: As mentioned earlier, companding tends to have little effect on strong signal as again repeated in the Figure 2.3 below where the signal is strong but the sampling level is low. The resulting digitized voice signal is always poor in quality but always has a signal reconstruction that is similar in structure with the original. This is as a result of the fact that sampling is done on appropriation that based on proper representation of low energy portion of the sampling signal. The important thing is that despite the fact that the digitized signal is poor quality, it can still retain the basic structure of the original signal with very few bits.

Rasaki Badaru
15 . 1

05 .

e d u t p m l a n g i s

0 -05 .

-1

o in l s n l rig a ig a d it e s n l ig iz d ig a

-15 . 0 00 .5 01 . tm [ e] i es c 01 .5 02 .

Figu re 2.3 Strong signal, strong level with mu=255 Weak signal with low sampling level: In any situation where the analog signal quality is poor, companding is more efficient in yielding a reasonable digitized voice signal that is good enough for reconstruction of the original signal. However, the quality of the digitized signal may be poor but it will still be acceptable as a replacement for the original signal. This is exactly the outcome of the lab as shown in Figure 2.5 below when companding is used along with weak signal at a very low sampling level. It can be seen that despite the poor quality of the signal, it is still possess structural form that is similar to the original signal. This is contrarily to the result in Figure 1.4 above that is entirely different in structure to the original signal.Thus, companding is more beneficial when used along with weak signal.
0.1 5

0.1

0.0 5

e d u t p m l a n g i s

-0.05

-0.1

orig inal sig a nl dig e sig al itiz d n

-0.15 0 0 5 .0 0 .1 tim [ e ] esc 0 .15 0 .2

Figure 2.4. Weak signal, low quantization with mu=255

Quantization Noise

Rasaki Badaru The quality of digitized voice signal is measured by the value of the signal-toquantization- noise ratio SQR calculated based on the ratio of the root-mean-square value of sampled values of the analog voice signal and the quantization error formed from the difference between the sampled values and the quantized values. The SQR is calculated with the following equation SQR=iNyi2NiN(yi-xi)2N=iNyi2(yi-xi)2, where y is the sampled value and x is the quantized value. The quantization error is inversely proportional to the sampling levels; the higher the sampling levels the less the quantization error and the better the SQR. The SQR does not only vary with sampling levels; it changes when never any single factor of PCM process varies. How SQR varies with various factors of PCM is best studied on individual basis. This is done by setting every other factor that is involved in the PCM process to constant value with the exception of the interested factor which is varied accordingly. The graph of Figure 3.1 shows how SQR is affected by varying the amplitude of analog voice signal with and without companding. When companding is not used in PCM process, the SQR plots shows direct proportionality of SQR values as the signal power increases. At a very low signal power, the SQR value is low resulting in a poor quality digitized signal that is depicted in Figure 1.3 above. Also, when the signal power is high, the SQR values is high and the digitized signal is expected to be good as depicted in Figure 1.1 above. Thus, the SQR value is a good indicator of nature of digitized signal from a PCM processing. On the other hand, as indicated in the Figure 3.1 below, when companding is used, the SQR maintains a relatively constant value that every SQR values jitter around as the amplitude increases. However, the average SQR jittered value is gives an indication of relatively good digitized signal. This can be seen from the results above under the companding studies. Thus, unlike the case where SQR increases with increases in signal power when compading is not used, the SQR values, with companding, maintains an average value that other values jitter around as amplitude increases.

Rasaki Badaru
25

20

15

] B D [ R Q S
10 5 S D m =0 QR B u 0 0 S D m =225 QR B u 0.2 0.4 0.6 s nla p d ig a m litu e 0.8 1 1.2

Figure 3.1. The graph of SQR with variable amplitudes at mu = 0 and 255 Another important factor studies along with SQR is the bit depth. As indicated above, digitized signal improves with increasing in sampling levels which ultimately improves the SQR with reduction in quantization error. This relationship is depicted in Figure 3.2 where the SQR values plotted against the varying bit depths is directly proportional to the incrementing bit depth. It can be seen that SQL values at every bit depths where companding is used is less than the corresponding values without companding. This is because companding optimizes the sampling by minimizing the number of bits needed to number that is just good enough to reconstruct the voice signal. Also from the graph, the SQR increases as the bit depth increases when companding is used unlike the case of increasing amplitude. It can also be deducted from the graph that considerable increase in SQL only occurred with the bit depths above 50.

Rasaki Badaru
30 25 20 15 10 5 0 -5 -10 0

] B D [ R Q S

SQR[DB] m =0 u SQR[DB] m =255 u 50 100 150 bit depth 200 250 300

Figure 3.2. The graph SQR with variable bit depths at mu=0 and 255

Conclusion
PCM process digitizes analog voice signal through the process of sampling and quantization. The digitized signal from PCM process improves in quality as the signal power and bit depth increases. With companding, analog signal with low signal power can still be digitized to give signal quality above poor level. Also, companding minimize the cost of transmitting digitized signal by optimizing the PCM process to the lowest minimal number of bits requires for reconstruction without distortion.

Appendix

Rasaki Badaru

A sample screenshot from the lab depicting of analog voice signal with corresponding digitized voice signal.

Das könnte Ihnen auch gefallen