CSc 3610 Programming Assignment #3

Work on this with your assigned partner. Take turns programming and error catching. Turn in one copy, with both names on it.

The first thing in your program should be documentation, just like with homework 1.


  1. Practice pair programming.
  2. Practice designing a program.
  3. Practice implementing a program design in MATLAB.
  4. To get familiar with matrices.
  5. To get familiar with sound data.

There is a sound file called violin.wav, available on Qubit. This sound file has a problem; there is an audible crackling noise. Your job is to find where the noise appears in the sound data, show it on a plot, and describe how it may be fixed.

MATLAB can work with sound, with commands like wavread, wavrecord, wavwrite, and sound. Other commands that you may need for this assignment include figure, plot, and title. Investigate these commands, and find out how you can use them to solve the problem below. Remember that you can access part of an array (or matrix) by giving a range of values. For example, a = b(654:1654); will copy the elements of b between 654 and 1654, and assign them to a.

Your program should first read in the violin.wav file. (You will need to transfer it to your MATLAB directory.) Then your program should play the .wav file. The sound data is actually a matrix, since there are two channels in a stereo system. You can ignore the second channel's data.

Next, your program should show the sound data up close, a little at a time, for one second's worth of data that includes the noise. To figure out where this data starts and where it ends is up to you; you should experiment with the sound data until you find a second's worth that includes the noise.

Do not plot the whole second's worth of data on the same plot, instead, plot it out a little at a time. To do this, plot a few hundred (say 200 to 1400) samples at a time (you decide how many samples to plot). Diplay on the plot what the starting sample is. Next, increment your starting sample by half of the width of the plot. Your program should either pause or wait for input before displaying the next plot. It should end the loop when it has shown the entire second's worth of data.

To solve your problem, write a program that reads the necessary information to compute and output the indicated values, as efficiently as possible. Design your program by specifying its behavior, identifying the variables and operations it needs to solve the problem, and then organizing the variables and operations into an algorithm. Then code your design in MATLAB using stepwise translation. Finally, test your program thoroughly.

E-mail your MATLAB source code to the TA (the TA's e-mail address is : ). Do not e-mail the design, do not e-mail the script/output. Do not CC the instructor in your e-mail. Your e-mail should clearly state who you are, that you are in this class, and what you are e-mailing. Make sure to CC yourself on the e-mail, and bring a printout of the e-mail with you to class (see item 4 below). This e-mail does not need to show the text of the attachment, but it should indicate that there is a(n) attachment(s) and what its name(s) is(are).

Turn In Electronic copies of your files to the TA.

Turn In Hard copies of:
  1. your design (behavior, variables, operations, algorithm)
  2. your source code
  3. a copy of your e-mail to the TA
  4. one print out of a plot, that shows noise. You should write on the plot, pointing out where the noise occurs.
The printouts of the above must be handed in during class. To be considered "on-time", you must turn in all of the above on-time. Make sure that your printouts use a monospaced font.

Due date: October 31, 2006