C.8 Comb filters 462 APPENDIX C. LABORATORY EXERCISES

Similar documents
Experiment 1 Introduction to MATLAB and Simulink

Memorial University of Newfoundland Faculty of Engineering and Applied Science. Lab Manual

Introduction to Simulink

COMMUNICATION LABORATORY

Lab 1: Simulating Control Systems with Simulink and MATLAB

Experiments #6. Convolution and Linear Time Invariant Systems

Introduction to Simulink Assignment Companion Document

Experiment 1 Introduction to Simulink

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

Lab 4 An FPGA Based Digital System Design ReadMeFirst

Lab 1: First Order CT Systems, Blockdiagrams, Introduction

ELG3311: EXPERIMENT 2 Simulation of a Transformer Performance

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

EE25266 ASIC/FPGA Chip Design. Designing a FIR Filter, FPGA in the Loop, Ethernet

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING. ECE 2026 Summer 2018 Lab #8: Filter Design of FIR Filters

DSP First Lab 08: Frequency Response: Bandpass and Nulling Filters

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

Figure C-1 (p. 907) MATLAB window showing how to access Simulink. The Simulink Library Browser button is shown circled.

Lab 8. Signal Analysis Using Matlab Simulink

Laboratory Assignment 1 Sampling Phenomena

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

EEL 4350 Principles of Communication Project 2 Due Tuesday, February 10 at the Beginning of Class

Basic Signals and Systems

Electrical & Computer Engineering Technology

EE477 Digital Signal Processing Laboratory Exercise #13

DSP First. Laboratory Exercise #2. Introduction to Complex Exponentials

ES442 Final Project AM & FM De/Modulation Using SIMULINK

Lab 2: Introduction to Real Time Workshop

Digital Video and Audio Processing. Winter term 2002/ 2003 Computer-based exercises

TSKS01 Digital Communication

ENGR 210 Lab 12: Sampling and Aliasing

L A B 3 : G E N E R A T I N G S I N U S O I D S

SIGNALS AND SYSTEMS LABORATORY 3: Construction of Signals in MATLAB

George Mason University Signals and Systems I Spring 2016

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

ECE411 - Laboratory Exercise #1

RF Blockset For Use with Simulink

ECEGR Lab #8: Introduction to Simulink

Digital Signal Processing ETI

Lab S-4: Convolution & FIR Filters. Please read through the information below prior to attending your lab.

Grid-Connected Full-Bridge Inverter Based on a Novel ZVS SPWM Scheme

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

DFT: Discrete Fourier Transform & Linear Signal Processing

Answers to Problems of Chapter 4

DSP First Lab 06: Digital Images: A/D and D/A

Lab 6: Sampling, Convolution, and FIR Filtering

DSP First. Laboratory Exercise #7. Everyday Sinusoidal Signals

Sound synthesis with Pure Data

SMS045 - DSP Systems in Practice. Lab 1 - Filter Design and Evaluation in MATLAB Due date: Thursday Nov 13, 2003

STANFORD UNIVERSITY. DEPARTMENT of ELECTRICAL ENGINEERING. EE 102B Spring 2013 Lab #05: Generating DTMF Signals

Spring 2018 EE 445S Real-Time Digital Signal Processing Laboratory Prof. Evans. Homework #1 Sinusoids, Transforms and Transfer Functions

FIR/Convolution. Visulalizing the convolution sum. Convolution

Digital Signal Processing ETI

Set-up. Equipment required: Your issued Laptop MATLAB ( if you don t already have it on your laptop)

ECE 5650/4650 MATLAB Project 1

Flanger. Fractional Delay using Linear Interpolation. Flange Comb Filter Parameters. Music 206: Delay and Digital Filters II

Lab 1: Steady State Error and Step Response MAE 433, Spring 2012

EGR 111 Audio Processing

GEORGIA INSTITUTE OF TECHNOLOGY SCHOOL of ELECTRICAL and COMPUTER ENGINEERING. ECE 2025 Fall 1999 Lab #7: Frequency Response & Bandpass Filters

Lab 4 Fourier Series and the Gibbs Phenomenon

EEE - 321: Signals and Systems Lab Assignment 3

EE 5410 Signal Processing

Laboratory Assignment 4. Fourier Sound Synthesis

The University of Queensland School of Information Technology and Electrical Engineering. ELEC3004/7312: Signals, Systems and Controls

Signal Processing First Lab 02: Introduction to Complex Exponentials Multipath. x(t) = A cos(ωt + φ) = Re{Ae jφ e jωt }

Linear Time-Invariant Systems

Additive Synthesis OBJECTIVES BACKGROUND

Lab P-4: AM and FM Sinusoidal Signals. We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: ) X

Signal Processing Blockset

Figure 1: Block diagram of Digital signal processing

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

George Mason University ECE 201: Introduction to Signal Analysis Spring 2017

Lab P-8: Digital Images: A/D and D/A

COMP 546, Winter 2017 lecture 20 - sound 2

Islamic University of Gaza. Faculty of Engineering Electrical Engineering Department Spring-2011

FIR/Convolution. Visulalizing the convolution sum. Frequency-Domain (Fast) Convolution

Assignment 8 Analyzing Operational Amplifiers in MATLAB and PSpice

Experiment # 4. Frequency Modulation

Lab S-5: DLTI GUI and Nulling Filters. Please read through the information below prior to attending your lab.

GE U111 HTT&TL, Lab 1: The Speed of Sound in Air, Acoustic Distance Measurement & Basic Concepts in MATLAB

TABLE OF CONTENTS SECTION 6.0

3 USRP2 Hardware Implementation

Lab 8: Frequency Response and Filtering

ELEC3104: Digital Signal Processing Session 1, 2013 LABORATORY 3: IMPULSE RESPONSE, FREQUENCY RESPONSE AND POLES/ZEROS OF SYSTEMS

George Mason University ECE 201: Introduction to Signal Analysis

Digital Signal Processing Laboratory 1: Discrete Time Signals with MATLAB

Real Analog - Circuits 1 Chapter 11: Lab Projects

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering. EIE2106 Signal and System Analysis Lab 2 Fourier series

Performing the Spectrogram on the DSP Shield

DSP First Lab 03: AM and FM Sinusoidal Signals. We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: k=1

Experiment 6: Multirate Signal Processing

Type pwd on Unix did on Windows (followed by Return) at the Octave prompt to see the full path of Octave's working directory.

14 fasttest. Multitone Audio Analyzer. Multitone and Synchronous FFT Concepts

THE CITADEL THE MILITARY COLLEGE OF SOUTH CAROLINA. Department of Electrical and Computer Engineering. ELEC 423 Digital Signal Processing

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

CMPT 468: Delay Effects

Fall Music 320A Homework #2 Sinusoids, Complex Sinusoids 145 points Theory and Lab Problems Due Thursday 10/11/2018 before class

EE 464 Short-Time Fourier Transform Fall and Spectrogram. Many signals of importance have spectral content that

Fourier Series and Gibbs Phenomenon

ITEC 2600 Introduction to Analytical Programming. Instructor: Prof. Z. Yang Office: DB3049

Transcription:

462 APPENDIX C. LABORATORY EXERCISES C.8 Comb filters The purpose of this lab is to use a kind of filter called a comb filter to deeply explore concepts of impulse response and frequency response. The lab uses Simulink, like lab C.6. Unlike lab C.6, it will use Simulink for discrete-time processing. Be warned that discrete-time processing is not the best part of Simulink, so some operations will be awkward. Moreover, the blocks in the block libraries that support discrete-time processing are not well organized. It can be difficult to discover how to do something as simple as an N-sample delay or an impulse source. We will identify the blocks you will need. The lab is self contained, in the sense that no additional documentation for Simulink is needed. As in lab C.6, be warned that the on-line documentation is not as good for Simulink as for Matlab. You will want to follow our instructions closely, or you are likely to discover very puzzling behavior. C.8.1 Background To run Simulink, start Matlab and type simulink at the command prompt. This will open the Simulink library browser. The library browser is a hierarchical listing of libraries with blocks. The names of the libraries are (usually) suggestive of the contents, although sometimes blocks are found in surprising places, and some of the libraries have meaningless names (such as Simulink ). Here, we explain some of the techniques you will need to implement the lab. You may wish to skim these now and return them when you need them. Simulation Parameters First, since we will be processing audio signals with a sample rate of 8 khz, you need to force Simulink to execute the model as a discrete-time model with sample rate 8 khz (recall that Simulink excels at continuous-time modeling). Open a blank model by clicking on the document icon at the upper left of the library browser window. Find the Simulation menu in that window, and select Parameters. Set the parameters so that the window looks like what is shown in figurec.9. Specifically, set the stop time to 4.0 (seconds), the solver options to Fixed-step and discrete (no continuous states), and the fixed step size to 1/8000. Reading and Writing Audio Signals Surprisingly, Simulink is more limited and awkward than Matlab in its ability to read and write audio files. Consequently, the following will seem like more trouble than it is worth. Bear with us. Simulink only supports Microsoft wave files, which typically have the suffix.wav. You may obtain a suitable audio file for this lab at http://www.eecs.berkeley.edu/ eal/eecs20/sounds/voice.wav

C.8. COMB FILTERS 463 Figure C.9: Simulation parameters for discrete-time audio processing in Simulink.

464 APPENDIX C. LABORATORY EXERCISES From Wave File voice (8000Hz/1Ch/8b) From Wave File simout To Workspace Figure C.10: Test model for Simulink audio. In Netscape you can go to http://www.eecs.berkeley.edu/ eal/eecs20/sounds/ and then right click on the voice.wav filename to bring up a menu, and choose Save Link As... to save the file to your local disk. It is best to then, in the Matlab command window, to change the current working directory to the one in which you stored the file using the cd command. This will make it easier to use the file. To make sure we can process audio signals, create the test model shown in figurec.10. To do this, in a new model window with the simulation parameters set as explained in Simulation Parameters on page 462, create an instance of the block called From Wave File. This block can be found in the library browser under DSP Blockset and DSP Sources. Set the parameters of that block to File name: voice.wav Samples per frame: 1 The first parameter assumes you have set the current working directory to the directory containing the voice.wav file. The second indicates to Simulink that it should produce audio samples one at a time, rather than collecting them into vectors to produce many at once. Next, find the To Workspace block in the Simulink block library, under Sinks. Create an instance of that block in your model. Edit its parameters to change the Save format to Matrix. You can leave other parameters at their default values. Connect the blocks as shown in figure C.10. Assuming the simulation parameters have been set as explained in Simulation Parameters on page 462, you can now run the model by invoking the Start command under the Simulation menu. This will result in a new variable called simout appearing in the Matlab workspace. In the Matlab command window, do soundsc(simout) to listen to the voice signal. Note that the DSP Sinks library has a block called To Wave Device, which in theory will produce audio directly to the audio device. In practice, however, it seems much easier to use the To

C.8. COMB FILTERS 465 x y S z S 2 Figure C.11: Comb filter modeled as a feedback system. Workspace block and the soundsc command. For one thing, soundsc scales the audio signal automatically. It also circumvents difficulties with real-time performance, platform dependence problems, and ideosyncrasies with buffering. However, if you wish to try the To Wave Device block, and can figure out how to get it to work, feel free to use it. C.8.2 In-lab section 1. Consider the equation 8 n 2 Integers; y(n) =x(n) +ffy(n N ) (C.8) for some real constant ff<1 and integer constant N > 0. Assume the sample rate is 8 khz. The input is x(n) and the output is y(n). The equation describes an LTI system where the output is delayed, scaled, and feb back. Such a system is called a comb filter, for reasons that will become apparent in this lab. The filter can be viewed as a feedback structure, as shown in figure C.11, where S 2 is a system with input y and output z. Give a similar equation describing S 2, relating y and z. 2. Implement in Simulink the comb filter from part (a). Provide as input the file voice.wav (see page 462). Send the output to the workspace, just like figure C.10, so that you can use soundsc to listen to the result. You will probably need the Gain and Sum blocks, which you can find in the Simlink, Math library. The delay in the feedback path can be implemented by the Integer Delay block, which you can find in the DSP Blockset, General DSP, Signal Operations library. Experiment with the values of N. TryN = 2000 and N =50and describe qualitatively the difference. With N =50, the effect is called a sewer pipe effect. Why? Can you relate the physics of sound in a sewer pipe with our mathematical model? Hint: The speed of sound in air is approximately 331:5 +0:6T meters/second where T is the temperature in degress celcius. Thus, at 20 degrees, sound travels at about 343.7 meters/second. A delay of N =50samples at an 8 khz sample rate is equal to the time it takes sound to travel roughly 2 meters, twice the diameter of a 1 meter sewer pipe.

466 APPENDIX C. LABORATORY EXERCISES Experiment with the value of ff. What happens when ff =0? What happens when ff = 1? When ff>1? You may wish to plot the output in addition to listening to it. 3. Modify your Simulink model so that its output is the first one second (the first 8001 samples) of the impulse response of the system defined by (C.8), with ff =0:99 and N =40. The simplest approach is to provide an impulse as an input. To do that, use the Discrete Pulse Generator block, found in the Simulink, Sources. This block can be (sort of) configured to generate a Kronecker delta function. Set its amplitude to 1, its period to something longer than the total number of samples (i.e. larger than 8001), its pulse width to 1, its phase delay to 0, and its sample time to 1/8000. You will also want to change the simulation parameters to execute your system for 1 second instead of 4. Listen to the impulse response. Plot it. Can you identify the tone that you hear? Is it a musical note? Hint: Over short intervals, a small fraction of a second, the impulse response is roughly periodic. What is its period? 4. In the next lab you will modify the comb filter to generate excellent musical sounds resembling plucked strings, such as guitars. As a first step towards that goal, we can make a much less mechanical sound than the impulse response by initializing the delay with random data. Modify your Simulink model so that the comb filter has no input, and instead of an input, the Integer Delay block is given random initial conditions. Use ff =0:99 and N =40, and change the parameters of the Integer Delay block so that its initial conditions are given by randn(1,40) The Matlab randn function returns a vector of random numbers (try help randn in the Matlab command window). Listen to the result. Compare it to the sound of the impulse response. It should be richer, and less mechanical, but should have the same tone. It is also louder (even though soundsc scales the sound). C.8.3 Independent section The comb filter is an LTI system. Figure C.11 is a special case of the feedback system considered in section 8.5.2, which is shown there to be LTI. Thus, if the input is then the output is x(n) =e j!n y(n) =H(!)e j!n where H: Reals! Complex is the frequency response. Find the frequency response of the comb filter. Plot the magnitude of the frequency response over the range 0 to 4 khz using Matlab. Why is it called a comb filter? Explain the connection between the tone that you hear and the frequency response.

C.8. COMB FILTERS 467 Instructor Verification Sheet for C.8 Name: Date: 1. Found an equation for S 2, relating y and z. 2. Constructed Simulink model and obtained both sewer pipe effect and echo effect. 3. Constructed the impulse response and identified the tone. 4. Created sound with random values in the feedback delay.