Basic MATLAB

profilehaolia
HW2.pdf

ECE203: Introduction to MATAB programming

HW2

Using the provided program record_sound.m record two different sounds (each eight seconds

long). One of them ought to contain at least 6 words of your choosing (a sentence). The other one

should be a music of your choosing. You may rename the my_sound.wav file generated by the

program after recording the first time around in order to avoid re-writing it (so that you have two

separate wave files that you can manipulate). Create a script file called run_sound_processing.m

and start by reading in those two wave files into two different variables. Note that the sampling

frequency should be the same (8K samples/sec) for both recording since you made use of the same

program to generate the wave files.

For this assignment perform the following tasks:

1. Process the one that contains the sentence so that only the words are left. That is, you are

to remove the quite instances. A plot of the waveform against sample indices and

MATLAB’s data cursor should be of great help here.

2. Process the other one (music) such that it mimics a gradual increase or decrease (your

choice) in volume.

3. Now mix the two by simply adding them. This will require that the two arrays are of the

same size (that is not the case since you have removed portions of quite instances from one

of the recordings). You will need to crop the one that contains music in order to be able to

add them. The end result ought to sound your sentence with music in the background that

will gradually close to take over (or the other way around depending on the type of volume

modification you opt to use).

4. Additionally, do provide a plot where the end-result is plotted against sample indices into

one subplot and another one where the end-result is plotted against time in seconds.

5. Lastly identify the maximum voltage value and where it occurs (at what instances time t in

seconds AND sample index) and make use of green circle to show it in your subplots.

Also, make use of text() to indicate the information about max into each subplots. Text

should be located at the max of both waveforms/sub-plots.

You will find useful files under MATLAB files folder. Other useful materials are indexing and

plotting chapters.