Experiment # 2. Pulse Code Modulation: Uniform and Non-Uniform

Similar documents
Experiment # 2 Pulse Code Modulation: Uniform and Non-Uniform

Experiment 02: Amplitude Modulation

Experiment # 4. Frequency Modulation

Experiment # 5 Baseband Pulse Transmission

Contents. Introduction 1 1 Suggested Reading 2 2 Equipment and Software Tools 2 3 Experiment 2

Exploring DSP Performance

Laboratory Assignment 1 Sampling Phenomena

Introduction to Lab Instruments

DIGITAL COMMUNICATION. In this experiment you will integrate blocks representing communication system

Pulse Code Modulation (PCM)

Lab 6: Building a Function Generator

DIGITAL COMMUNICATION

17. Delta Modulation

Voice Transmission --Basic Concepts--

Experiment 6: Multirate Signal Processing

Digital Communication Prof. Bikash Kumar Dey Department of Electrical Engineering Indian Institute of Technology, Bombay

THE SPEAKER. The decibel scale is related to the physical sound intensity measured in watts/cm 2 by the following equation:

ECE 556 BASICS OF DIGITAL SPEECH PROCESSING. Assıst.Prof.Dr. Selma ÖZAYDIN Spring Term-2017 Lecture 2

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

Pulse Code Modulation

CHAPTER 4. PULSE MODULATION Part 2

EEE 309 Communication Theory

EE 3302 LAB 1 EQIUPMENT ORIENTATION

TCET3202 Analog and digital Communications II

The Fundamentals of Mixed Signal Testing

ECE159H1S University of Toronto 2014 EXPERIMENT #2 OP AMP CIRCUITS AND WAVEFORMS ECE159H1S

Pulse Code Modulation

INTRODUCTION TO COMMUNICATION SYSTEMS LABORATORY IV. Binary Pulse Amplitude Modulation and Pulse Code Modulation

ET 304A Laboratory Tutorial-Circuitmaker For Transient and Frequency Analysis

LAB #7: Digital Signal Processing

Lab Report #10 Alex Styborski, Daniel Telesman, and Josh Kauffman Group 12 Abstract

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

Laboratory set-up for Real-Time study of Electric Drives with Integrated Interfaces for Test and Measurement

Digital Communication (650533) CH 3 Pulse Modulation

Combinational logic: Breadboard adders

8A. ANALYSIS OF COMPLEX SOUNDS. Amplitude, loudness, and decibels

ENSC327 Communication Systems Fall 2011 Assignment #1 Due Wednesday, Sept. 28, 4:00 pm

Lab 4: Using the CODEC

E x p e r i m e n t 2 S i m u l a t i o n a n d R e a l - t i m e I m p l e m e n t a t i o n o f a S w i t c h - m o d e D C C o n v e r t e r

2 AC and RMS. To pass this lab you must solve tasks 1-2. Tasks 3 and 4 are included in the grading of the course.

ECE 2111 Signals and Systems Spring 2009, UMD Experiment 3: The Spectrum Analyzer

LAB II. INTRODUCTION TO LABVIEW

EEE 309 Communication Theory

VCC. Digital 16 Frequency Divider Digital-to-Analog Converter Butterworth Active Filter Sample-and-Hold Amplifier (part 2) Last Update: 03/19/14

Getting Started. MSO/DPO Series Oscilloscopes. Basic Concepts

EET 223 RF COMMUNICATIONS LABORATORY EXPERIMENTS

ECE 2111 Signals and Systems Spring 2012, UMD Experiment 9: Sampling

ME 365 EXPERIMENT 8 FREQUENCY ANALYSIS

Digital Audio. Lecture-6

Lab 1: Simulating Control Systems with Simulink and MATLAB

Chapter 2: Digitization of Sound

Experiment 1 Introduction to MATLAB and Simulink

ME 461 Laboratory #2 Timers and Pulse-Width Modulation

Lab 12 Laboratory 12 Data Acquisition Required Special Equipment: 12.1 Objectives 12.2 Introduction 12.3 A/D basics

Oscilloscope and Function Generators

LAB 2 SPECTRUM ANALYSIS OF PERIODIC SIGNALS

Waveform Generators and Oscilloscopes. Lab 6

Communications IB Paper 6 Handout 3: Digitisation and Digital Signals

Integrators, differentiators, and simple filters

Presentation Outline. Advisors: Dr. In Soo Ahn Dr. Thomas L. Stewart. Team Members: Luke Vercimak Karl Weyeneth. Karl. Luke

TELECOMMUNICATION SYSTEMS

Part 1. Using LabVIEW to Measure Current

Laboratory Experiment #1 Introduction to Spectral Analysis

Introduction to Simulink Assignment Companion Document

Experiment # 3. Doppler Spread

PULSE CODE MODULATION (PCM)

Advanced Audiovisual Processing Expected Background

Communications I (ELCN 306)

ECE 3155 Experiment I AC Circuits and Bode Plots Rev. lpt jan 2013

Physics 120 Lab 1 (2018) - Instruments and DC Circuits

ECEn 487 Digital Signal Processing Laboratory. Lab 3 FFT-based Spectrum Analyzer

EE-4022 Experiment 2 Amplitude Modulation (AM)

10 Speech and Audio Signals

Exercise 1: AC Waveform Generator Familiarization

Senior Design Project: Converting an Analog Transceiver into a Digital one

Lab E2: B-field of a Solenoid. In the case that the B-field is uniform and perpendicular to the area, (1) reduces to

MTI 7602 PCM Modulation and Demodulation

Lab 4 An FPGA Based Digital System Design ReadMeFirst

Downloaded from 1

MASSACHUSETTS INSTITUTE OF TECHNOLOGY /6.071 Introduction to Electronics, Signals and Measurement Spring 2006

Problem Sheet 1 Probability, random processes, and noise

Class #9: Experiment Diodes Part II: LEDs

Lab 3 FFT based Spectrum Analyzer

ECEGR Lab #8: Introduction to Simulink

Experiment 1.A. Working with Lab Equipment. ECEN 2270 Electronics Design Laboratory 1

RC Filters and Basic Timer Functionality

University of California, San Diego Department of Electrical and Computer Engineering

EEE482F: Problem Set 1

P a g e 1 ST985. TDR Cable Analyzer Instruction Manual. Analog Arts Inc.

When you have completed this exercise, you will be able to determine the frequency response of a

Tektronix digital oscilloscope, BK Precision Function Generator, coaxial cables, breadboard, the crystal earpiece from your AM radio kit.

LABORATORY 4. Palomar College ENGR210 Spring 2017 ASSIGNED: 3/21/17

USE OF BASIC ELECTRONIC MEASURING INSTRUMENTS Part II, & ANALYSIS OF MEASUREMENT ERROR 1

Class #8: Experiment Diodes Part I

Experiment Guide: RC/RLC Filters and LabVIEW

ENSC327/328 Communication Systems Course Information. Paul Ho Professor School of Engineering Science Simon Fraser University

Multirate DSP, part 3: ADC oversampling

CHAPTER 4 FIELD PROGRAMMABLE GATE ARRAY IMPLEMENTATION OF FIVE LEVEL CASCADED MULTILEVEL INVERTER

Advanced Lab LAB 6: Signal Acquisition & Spectrum Analysis Using VirtualBench DSA Equipment: Objectives:

Experiment # 1 Introduction to Lab Equipment

Transcription:

10 8 6 4 2 0 2 4 6 8 3 2 1 0 1 2 3 2 3 4 5 6 7 8 9 10 3 2 1 0 1 2 3 4 1 2 3 4 5 6 7 8 9 1.5 1 0.5 0 0.5 1 ECE417 c 2017 Bruno Korst-Fagundes CommLab Experiment # 2 Pulse Code Modulation: Uniform and Non-Uniform Name: Experiment Date: Student No.: Day of the week: Time: Name: Student No.: Grade: / 10 E000 Input Signal Mask Output x 10 3 x 10 3 µ 1 [ln(1+mu)]^ 1 ABS X + ln X 10 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 sign 1.5 0 0.002 0.004 0.006 0.008 0.01 0.012 0.014 0.016 0.018 0.02 1 Purpose The purpose of this experiment is to introduce uniform and non-uniform Pulse Code Modulation (PCM). Uniform PCM will be explored through probing quantization, and Non-uniform PCM will be introduced with the implementation of a µ-law compressor. PCM is a technique widely used in communication systems, in particular in the conversion of analog signals into their digital representation for processing and transmission. This experiment will be divided in four parts: First, you will explore Uniform PCM by modifying the number of bits using to quantize each 1

sample of a signal. You will use different number of bits per sample and observe the relation between number of bits per sample and quantization noise; You will then simulate a µ-law compressor and modify its parameters to verify the outcomes; Finally, you will run the µ-law compressor on the DSP platform to observe the results on your oscilloscope. 2 Background Reading and Preparation It is fair to say that every textbook in digital signal processing starts by describing how an analog signal is converted into a digital one prior to being processed. Sampling and quantization are described in detail in many references. Therefore, rather than looking for a single reference for background reading, you can refer to any of the textbooks cited in the bibliography presented at the end of this outline. Keep in mind, however, that these should be seen as introductory reading, since they only touch on PCM as applied to A/D conversion. Some references [1], [2] and [3], look at PCM from the point of view of communication systems, and go beyond A/D conversion. You should review your notes on sampling and quantization, or on analog-to-digital conversion. With the µ-law PCM scheme, the signal will pass through a compressor, which will apply a logarithmic mapping to the incoming signal prior to quantization. The quantization of the compressed incoming signal is then done with a smaller number of bits per sample. The compression method you will utilize in this experiment is defined in the ITU/T G.711 standard. The outcome of µ-law and A-Law compressors is very similar, and both can be implemented in a table look-up algorithm in which the compression curve is stored in an array and the output is generated by mapping the normalized input onto that array. Non-uniform quantization allows for the signal-to-noise ratio to be kept through the dynamic range of the signal. The louder parts of the signal (which are statistically less prevalent in telephony) are quantized with a smaller number of bits than they would with a uniform quantizer, resulting in a lower signal-to-noise ratio. That is, by applying compression prior to quantization, the signal that extends beyond a certain level will likely utilize only a few more bits per sample (the most significant ones) than would a softer signal. In turn, the softer signal will present a higher signal-to-noise ratio than the louder signals, keeping the ratio constant through the dynamic range. Subjectively, compression on a voice signal would be perceived by a loss of quality in the signal for loud talkers. At the receiving end, the compressed signal is passed through an expander and the original signal is recovered. It is possible, for instance, to achieve a compression from 14 bits to 8 bits on a voice signal (a compression ratio of 1.75:1) without much computational complexity. Before coming to the lab, complete the lab preparation and hand it to the T.A.. 2

3 Experiment 3.1 Uniform Quantization This section is divided into three main parts: the simulation of a system presenting aliasing; the modification of sampling rates to verify the occurence of aliasing on real signals; and the verification of the relation between signal integrity and word length in the quantization process. Differently that the previous experiments where you verified the concepts by designing a whole system (such as an FM modulator), this section will touch individually on the two main parts of PCM, namely: sampling and quantization. The reason for taking this approach is primarily due to the fact that the target hardware already provides a CODEC which utilizes PCM to convert the signal from analog to digital. In this section you will modify the data generated by the existing CODEC and observe the consequences of the modifications on the output signal. 3.1.1 Fewer Bits, More Noise You should expect that as you reduce the number of bits assigned per sample of the incoming analog signal, you should have a gradually less accurate digital representation of your analog signal. Consider the extreme case: you have one bit to represent samples of a sinusoid. Of course, with only two values possible, one of them would be assigned to every sample in the positive cycle of the sinusoid and the other would be assigned to every sample in the negative cycle. The result would be a square wave with the same period as the original sinusoid. Now consider the frequency domain view of this new signal sampled with only one bit per sample. You used to have one component (ideally an impulse) in the frequency domain for the sinusoid, and after sampling it you have that same component and all of its odd harmonics. This is not at all a faithful representation of the analog signal. As you increase the number of bits, you decrease the amount of quantization noise, achieving a gradually better representation of your signal. The program to be run on the DSP is given to you. First, open Code Composer Studio and open the project named ECE316 04b quantization. You will run a version of the last experiment in ECE316. Look briefly at the code in quantization masking.c. You are to change the code to modify the number of bits used for each sample of the input signal. The CODEC provides 16 bits for each sample on each channel. You will force the samples for one of the channels to be quantized by using only a reduced number of bits. When you reduce the number of bits on the quantization, you increase the error introduced in the process by reducing the number of quantization levels available. So, should you modify the MSBs or the LSBs to accomplish this? The operation you will utilize to modify the word length of the incoming signal is known as masking, and you likely have already made use of it in a Microprocessors course. It consists of performing a logical AND operation between the data word passed on to the DAC and a mask that you select. Looking at your quantization.c program, you will notice that there are several masking options for the y variable. Use only one mask at a time, and comment out the others. You may change the mask to answer the questions below. Do not forget to recompile and run the program every time you make a change. 3

Use an input signal of around 1.8 V pp and 100Hz. You can choose to use a sine wave or a ramp. The reason you are using 1.8 V pp is that you must utilize the full range of the CODEC. If you do not have the full range of the signal going into the CODEC, you will not get the right results. You are to implement a 3-bit quantizer using an appropriate mask. What should the mask be? How many quantization levels are there? Explain what part of the sample 16-bit field the mask is selecting. (1pt) Sketch the original signal, the quantized signal, and the quantization error (noise) by using the Subtraction function in Math mode on the oscilloscope. The quantization error is the difference between the original signal and its quantized version. Using cursors, measure the error (in Volts). Now add one bit to the quantizer. Compile, run and measure the error again. What is the difference in db? (use a 500Hz Ramp as your input signal)(2pts) Show your quantization error output on the oscilloscope to the TA, and have the TA sign here. (1pt) 3.2 Non-Uniform Quantization In this part, you will simulate first and then run a µ-law compressor. You will be required to understand the implementation of the compressor and relate it back to the theory, and to verify the characteristic curves for different parameter values. This is a fancy way of saying: vary the level at the input, read the level at the output and plot points for every level. 4

3.2.1 Simulation of a µ-law Compressor It is assumed that you are familiar with Simulink. If you can t find the simulation blocks you are looking for, you can run a search within Simulink. Remember that you will always use discretetime systems in the ECE417 experiments, and the sampling time of your blocks must be set to 1/48000. This is so that the system you simulate is representative of what you will implement on the DSP target. Not every block requires that you set a sampling time. Those which do require, must be set to 1/48000. Your first system will be made of a DSP-Sine wave generator, a ramp generator, a switch, your compressor of choice found in the ECE417 blockset and two time-based scopes. You can use the template file exp02 sim.mdl provided on the lab web page. It will look like figure 1 below. Figure 1: Non-Uniform PCM - model for simulation Use scopes to view the output of the generators and to view the output of the compressor. Your sine wave and ramp signals should be set to 1000Hz, amplitude of 1 and sampling frequency of 48KHz (this means sampling time of 1/48000 in the proper field of the sine wave generator block). Run the system and configure the time-based scopes to provide you with the best reading. You should observe the scopes looking like the Figure 2 (notice the maximum level of 1). (a) µ-law Ramp (b) µ-law Sine Figure 2: Scope Displays After Compression: Ramp and Sine 5

Since you are simulating a µ-law compressor, use first a µ value of 255. As you know from your preparation, this is a standard value and is equivalent to an A-Law value of 87.6. They are determined through subjective voice tests (Mean Opinion Square). If you right-click on the Mu-Law Compressor block, and select look under mask, a window will open with the block diagram presented in Figure 3 (comments were added for clarity). Figure 3: µ-law Compressor - modified from Simulink Library After you got these models going, answer the question below: Now you will draw the characteristic curve for your compressor. You will use four values for the constant, vary the input signal amplitude from 0.01 to 1.0 and measure the output (pick five points and draw the graph with input amplitude on the x axis, and output amplitude on the y axis). Use a sine as an input. Use the values 0, 10, 255 and 1000 for µ. Draw the graph for every value of the constant (that is µ) and comment on your results.(3pts) 6

You could, alternatively, use an XY Graph found in the main blookset in Simulink to view the curves. Your simulation model would then look like the picture below. Since you are interested in input values from 0 to 1, you should set the axis of your XY Graph to those values by right-clicking on the block. Figure 4: Alternative simulation with XY Graph Show the XY scope running and explain to the TA what is going on, so that the TA can sign the box. (1pt) 3.3 Implementing and Evaluating A-Law Compressors In this part of the experiment, you will run your compressor on a DSP platform. Keep in mind that this compression is supposed to be applied prior to assigning bits to the levels (remember uniform PCM above?), so that the most compressed (higher) signal levels will have less room to manoueuvre, as you have just observed in the simulation. At the receiving end, the signal will be expanded back to its original shape. Systems which implement compression and expansion are known as companders. Here you will be given the programs to be loaded and run on the DSP platform. If you would like to design your own compander some other time, refer to [4]. The procedure to run the program is as follows: Open Code Composer Studio (CCS). Select the project named ECE417 Exp02 A Law (this really means: click on it), from the CCS project tree. With the project selected, click on the green bug at the top of the CCS menu, so that the project compiles; If there are no errors (there shouldn t be any), run the project by clicking on the sideways green triangle at the top menu. If there are any errors, resolve them (!); 7

With the program running, use as input a 500Hz sine wave, 1.7 V pp. If you go beyond 1.7 V pp you will observe a corruption on the signal. There is also a 180 degree phase shift on the output relative to the input, which can be corrected with a minus sign applied to one of the outputs. There are two output channels. Look at the code and you will see that for one channel, compression is applied to the input and the result is sent straight to the output, whereas for the other channel, compression and expansion are applied prior to the output. What you observe is, then, the full process in one of the channels. Compare the channel undergoing both compression and expansion with the input coming straight from the signal generator. Use a 500Hz sinusoid at 1.7 V pp at most. You should see no qualitative difference between the two except for a phase delay, due to the process of compressing and expanding. Try to explain how the process of compressing and expanding takes place. Show the running system to the TA, and have the TA sign the box. (1pt) 4 Accomplishments In this experiment, you acquired a better understanding of Pulse Code Modulation by further probing into uniform and non-uniform quantization. You verified the impact caused by the number of bits on quantization noise, and also verified the effect of compression and expansion on a signal. References [1] S. Haykin and M. Moher Introduction to Analog and Digital Communications, 2nd Ed. - Wiley, 2007 [2] B. P. Lathi, Modern Digital and Analog Communication Systems, 3rd Edition. New York: Oxford University Press, 1998. [3] S. Haykin Communication Systems, 4th Edition. Toronto: John Wiley & Sons, Inc., 2001. [4] P. M. Embree C Algorithms for Real-Time DSP, Prentice Hall, 1995. 8

Preparation - Uniform and Non-Uniform Quantization Name: Experiment Date: Student No.: Grade: / 10 1. Sketch the process of sampling and quantization for a 1KHz sine wave sampled at 8KHz. You are to use a 3 bit quantizer and assume linear quantization. Use your illustration to explain quantization noise. (2pt) 2. Write the equations for µ-law and A-Law compression. What are the typical values for the µ parameter and the A parameter? (assume 8 bits)(2pt) 3. Based on your experience in Simulink, draw a block diagram to implement a µ-law OR an A-Law compressor.(2pt) 9

4. Explain how the use of non-uniform quantization causes the SNR to become almost independent of the input signal power for a large dynamic range.(2pt) 5. You have a speech signal and a sinusoidal signal. Based on your knowledge of their probability density function, explain on which of them it would be most appropriate to apply non-uniform quantization. (2pt) 10