Beruflich Dokumente
Kultur Dokumente
Submitted to-
COMPUTER SCIENCE & ENGINEERING DEPARTMENT, Royal School of Engineering and Technology, Royal Group of Institutions, Guwahati-35
In partial fulfillment of BE degree in CSE
Under the guidance of-
Prof. M Elahi
ACKNOWLEDGEMENT
We would like to pay our sincere thanks to Prof. Mamoon Elahi, Head of Electronics & Telecommunication Department, RSET, helping us in completing our Laboratory report on PCM. We would also like to thank our friends for helping us directly or indirectly towards the completion of our report.
ABSTRACT
PCM is a digital scheme for transmitting analog data. The signals in PCM are binary, that is there are two possible states represented by 1 (high) and 0 (low). Using PCM it is possible to digitize all forms of analog data including motion videos, telemetry and Virtual Reality. It was the first method which was developed for the digital coding of the waveforms. PCM is the most applied of all the digital coding system in use today. In this report we shall present a brief discussion on pulse modulation techniques and show a small program on it.
CONTENT
1 2 3 4 5 6 7
Introduction History Process involved in PCM Sampling Quantization Encoding Original Signal Recovery Advantages and Disadvantages Sample PCM Program Algorithm Flowchart Code Result Conclusion Reference
4 5 6 7 8 9 10
11
9 10 11 12 13 14 15
12 13 14 15 16 17 18
INTRODUCTION
Pulse-code modulation (PCM) is a method used to digitally represent sampled analog signals. It is the standard form for digital audio in computers and various Blu-ray, DVD and Compact Disc formats, as well as other uses such as digital telephone systems. A PCM stream is a digital representation of an analog signal, in which the magnitude of the analog signal is sampled regularly at uniform intervals, with each sample being quantized to the nearest value within a range of digital steps. It consists of three main parts: (a) Transmitter (b) Transmission Path (c) Receiver
HISTORY
British engineer Alec Reeves, considered the use of PCM for voice communication in 1937 while working for International Telephone and Telegraph in France. He described the theory and advantages, but no practical use resulted. Reeves filed for a French patent in 1938, and his U.S. patent was granted in 1943. The first transmission of speech by digital techniques was the SIGSALY encryption equipment used for high-level Allied communications during World War II. In 1943, the Bell Labs researchers who designed the SIGSALY system became aware of the use of PCM binary coding as already proposed by Alec Reeves. In 1949 for the Canadian Navy's DATAR system, Ferranti Canada built a working PCM radio system that was able to transmit digitized radar data over long distances. PCM in the late 1940s and early 1950s used a cathode-ray coding tube with a plate electrode having encoding perforations. As in an oscilloscope, the beam was swept horizontally at the sample rate while the vertical deflection was controlled by the input analog signal, causing the beam to pass through higher or lower portions of the perforated plate. The plate collected or passed the beam, producing current variations in binary code, one bit at a time. Rather than natural binary, the grid of Goodall's later tube was perforated to produce a glitch-free Gray code, and produced all bits simultaneously by using a fan beam instead of a scanning beam.
First the analog signal is sampled. Then the sampled signal is quantized. And finally the quantized values are encoded as streams of bits
SAMPLING
The first step in PCM is sampling. The analog signal is sampled every T s sec, where T s is the sample interval or period. The inverse of the sampling interval is called the sampling rate or sampling frequency and denoted by f s , where f s = 1/T s .
R R R R R R R R R R
There are three sampling methods - ideal, natural and flat-top as shown in figure.
In ideal sampling, pulses from the analog signal are sampled. This is an ideal sampling method and cannot be easily implemented. In natural sampling, a high-speed switch is turned on for only the small period of time when the sampling occurs. The result is a sequence of samples that retains the shape of the analog signal. The most common sampling method is called sample and hold which creates flat-top samples by using a circuit. The sampling process is sometimes referred to as pulse amplitude modulation (PAM). However, the result is still an analog signal with non-integral values.
QUANTIZATION
The result of sampling is a series of pulses with amplitude values between the maximum and minimum amplitudes of the signal. The set of amplitudes can be infinite with non-integral values between the two limits. These values cannot be used in the encoding process. The following are the steps in quantization: 1. We assume that the original analog signal has instantaneous amplitudes between V min and V max . 2. We divide the range into L zones, each of height D (delta). =
3. We assign quantized values of 0 to L - I to the midpoint of each zone. 4. We approximate the value of the sample amplitude to the quantized values.
ENCODING
The last step in PCM is encoding. After each sample is quantized and the number of bits per sample is decided, each sample can be changed to an n b -bit code word. The number of bits for each sample is determined from the number of quantization levels. If the number of quantization levels is L, the number of bits is n b = log 2 L. The bit rate can be found from the formula Bit rate = sampling rate x number of bits per sample = fs * nb
ALGORITHM
1. Clear the previous coding stored in Matlab. 2. Read the speech signal using waveread function. Waveread(path of the file\ filename.wav) 3. Store all the data in a variable. [a,fs] = Waveread(path of the file\ filename.wav) 4. Declare the time interval as t. t = 0 : 1/fs : (length(a) 1)/fs 5. Find the maximum and minimum amplitude of the signal. x = max(a) y = min(a) 6. Shift the signal by minimum amplitude of a. a=a+y 7. Declare the quantization level l. 8. Multiply the quantization level with a. 9. Round of the value of a and store the value in another variable b. b = round(a) err = a b 10.Repeat step 9 until variable k goes to x. 11.Plot the signal b with respect to t.
FLOWCHART Start
Stop
CODE
close all; clear all; [a,fs]=wavread('C:\Windows\Media\Windows Shutdown.wav'); e=size(a); sound(a,fs); t=0:1/fs:(length(a)-1)/fs; t=t*10000; x=max(a); y=min(a); a=a+50000; l=100; a=a*l; for k=0:x; b=round(a); err=a-b; end mseerr=mse(err); plot(t,a); plot(t,b);
RESULT
Input Signal:
Output Signal:
CONCLUSION
Finally we come to a conclusion that PCM is a very effective technique which is widely among other conversion techniques. Also we successfully completed our sample program by digitizing the sample music file from our computer. The mean square error is found to be 0.0463.
REFERENCE
BOOKS: 1. Digital Communication By Sanjay Sharma 2. Data Communications and Networking By Behrouz A Forouzan