New version page

CMU 18396 Signals and Systems - Lab 2: Sound Signals

Documents in this Course
Load more
Upgrade to remove ads

This preview shows page 1-2 out of 5 pages.

Save
View Full Document
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 5 pages.
Access to all documents
Download any document
Ad free experience

Upgrade to remove ads
Unformatted text preview:

Lab 2: Sound Signals Lab session dates: February 9, 10, and 11 • As in the case of Lab 1, all grades will be given on a per-person basis, not per group. • The files that you produce in this lab will be used in later labs. Store them onto a memory stick, or back them up to your personal AFS space, or email them to yourself. Files stored on the local machines in the lab are likely to be deleted by other users or by the lab staff. INTRODUCTION Sound is one type of signal. In this lab you will convert audible sound into discrete-time signals, and perform simple analyses on the signals, such as finding the amplitude of the waveform. You can also do some other simple processing on the sound signal, such as changing the time scale of the waveform while maintaining its shape. Finally, you will do the reverse of converting audible sound into discrete-time signals, by writing MATLAB code that generates a discrete-time signal, and plays it as an audible sound. GRADING Each lab is divided into two sections: Pre-Lab (which is 40 percent of the grade) and In-Lab (60 percent of the grade). For the Pre-Lab, 1/3 of the credit will be based on the answers in the hand-in answer sheet (which must be turned in at the beginning of the lab), and 2/3 of the credit will be based on the answers to the quiz at the beginning of the lab section. For the In-Lab, in addition to showing your results to the TA, you also need to be ready to explain your answers to the TA, and be prepared to answer questions.18-396 Lab 2 Page 2 Spring 2009 Section 1: Pre-Lab Please read and follow the instructions. They will help you get started for the lab. • Read the sections of the book Labs for Signals and Systems by V. Stonick and K. Bradley (former CMU faculty and student) on “Sampling Review,” “Loudness and Pitch in Audio Signals,” and “A Mathematical Model of the Echo Process”. These sections have been scanned and are available on the course Web site. • Review the concept of convolution taught in class. (a) Calculate the convolution of x=[1 -1] and y=[1 0 0 1]. (b) Let z be the result of convolution of x and y. What is the relationship between length(z), length(x), and length(y)? • Bring your lecture notes and/or textbook(s) to the lab. You will find them helpful. Problem LP2.1: Verify your convolution result in pre-lab by using the MATLAB command conv. Read the help file for conv. Problem LP2.2: This problem reviews how to write a MATLAB function. In the lab itself you will apply these functions to the digitized sound signals. (1) Write a MATLAB function, naming it “half.m”, which removes every other element from a vector, thereby creating a shorter vector made of only the odd-numbered elements of the original vector. DO NOT USE LOOPS! (Use vector variables instead.) Your function must work with both column vectors and row vectors. (2) Write another function, “double.m”, that creates a longer vector by adding an additional element between neighboring elements in the original vector. Each new element should equal the average of its neighboring elements. DO NOT USE LOOPS! Your function must work with both column vectors and row vectors.18-396 Lab 2 Page 3 Spring 2009 Section 2: In-Lab We expect every student be able to answer questions after the lab. That means, the TA will ask questions on a per-person basis, not per group. If during the lab your partner puts more effort, be sure to understand everything before proceeding to the next problem. Problem L2.1: The file ‘chickens.wav’ (which can be downloaded from the Website) contains a segment of a sampled signal. Use a sampling rate of 8000 Hz whenever you have the option to specify it. (1) Play this file using your computer’s sound program. Use a sampling rate of 8000 Hz whenever you have the option to specify it. (2) Play the same file using the sound command of MATLAB. You will need to use MATLAB wavread to load the sound file. Read the help document for wavread and use wavread to verify that the sampling rate of your signal is as desired (8000 Hz). (3) Make a plot of the signal. Label the horizontal axis with time in seconds. Note that in order to be able to do that, you need to know the sampling frequency, which tells you the relationship between time and the sample values. (4) What is the maximum amplitude of this signal? Mark the sample(s) of maximum amplitude with a red circle on the peak(s) of the waveform. You might need the MATLAB commands max and hold. Read the help file of these commands (if you need them). Note that there might be “multiple” maximum amplitude peaks. (5) Play the sound back with soundsc. Did you hear any difference between sound and soundsc? Read help sound to understand the difference. Use sound to produce the same output as soundsc for this signal. Problem L2.2: Hook up the output of the function generator at your lab station to the oscilloscope. Generate a sine wave having a maximum amplitude of 0.7 V. Connect the output from the function generator also to the “line-in” input of the sound card. Connect the headphone to the output of the sound card. Listen to the headphone as you vary the frequency and amplitude. Try out (a) square, (b) triangular, and (c) sinusoidal waveforms. Document your observations when you: (1) double the frequency (2) halve the frequency (3) double the amplitude (4) halve the amplitude18-396 Lab 2 Page 4 Spring 2009 Problem L2.3: Save the signals that you sample in this section as you will use them in later sections. (1) Generate a 100-Hz sine wave with the function generator. Use a signal amplitude between 0.5 and 0.7 V. Verify that the waveform is as it should be with the oscilloscope before connecting the input to the sound card. (2) Use your computer’s sound program to sample this sine wave. Use a sampling rate of 8000 Hz. Sampling a short segment of the sine wave will allow you to proceed more quickly in the lab. But make sure that you sample at least one complete period. (3) Play back your waveform and view it on the oscilloscope. (4) Use the MATLAB wavread command to import your .wav file and make a plot of the signal. Label the horizontal axis in seconds. Before labeling, verify that the sampling rate is 8000 Hz. (5) Repeat the above steps except


View Full Document
Download Lab 2: Sound Signals
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab 2: Sound Signals and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab 2: Sound Signals 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?