Lab exercise #2.
Spectral analysis and filtering.
The goal of this exercise is to understand the types of manipulations that are possible with the available tools such as MATLAB. You will need a sound board and software that supports recording with a microphone
1. doubleclick the ‘Goldwave’ icon. It has many options to cut and paste portions of the signal.
Set the sampling rate to 22050
Set the duration to 2 sec
you are now set to record a speech fragment.
Click on the icon with the red dot (record button). A window let's you see what level you are speaking into the microphone at.
As soon as you click record: say “shoo cat”
then click on the stop button. Play the segment to determine if you need to adjust your speaking level… too soft or too loud?
You can also select the portion of the signal that contains the passage.
2. MATLAB handles 16-bit “.wav” files. It is best to have a relatively short sample ~1-2 seconds since it will affect the analysis time. You could have up to 10 seconds of signal if you are willing to wait. However, if MATLAB has to use the disc for really large files and/or variables we may not hear from you again.
3. Use save as to write the waveform as shoo_cat.wav in the c:\ phys735\yourfolder directory. Exit Goldwave.
4. exit and startup MATLAB.
5. read in your sound file.
to play out the sound: sound(y,sf,16);
you can vary the sample rate and replay the sound:
try sf = 20000, & then sf = 24000;
6. filtering: filtspa that will perform filtering of the signal: both low pass and high pass.
copy the .m file called filtspa.m, located in c:\phys735 to your folder.
follow the instructions. The results will be played out and the spectra displayed. This uses a particular filter called a Butterworth (5th order). There are several types of filters available that you could explore if you desire. The corner frequency can be varied to achieve different amounts of filtering from either the high or low frequency end of the spectrum. You could use both the high and low pass features to obtain a 'bandpassed' signal.
7. spectrogram: It will be obvious that a Fourier analysis of this signal provides a limited picture of what the instantaneous energy vs frequency distribution. One way around this limitation is to perform the analysis on a short portion of the signal at a time (maybe 5 to 20 ms epochs) and to analyze the entire time signal in this manner. Study the spectrogram. If you have a ripple pattern as a function of frequency over some epoch what might be the cause of it?
Another display that is often used is the waterfall display (for some reason its quite slow): you can vary the angle at which the 3D display is shown by the use of the view command; try it by typing view (-37, 75). You could also see what happens if you convert the data to use a log scale: try b=10*log10(b + 1); then waterfall(t',f',b); It takes a little time to redisplay the graph.
There is also a contour plot that is generated.
There are a variety of displays that one could explore: mesh(b), surf(b).
you can get help on any of these by typing: help mesh, etc.
******to complete this exercise plot both the time waveform and the spectrogram. Annotate the spectrogram: what portion of the spectrogram corresponds to each portion of the time signal—i.e., “shoo cat”? Explain what you see in the spectrogram. Hand in.
8. listen to the copy of a CD: “Perceptual
consequences of cochlear damage” by Brian C.J. Moore. It is located in the
Phys735 directory. Click on the
There are several examples of the effect of varying degrees of hearing loss and how various hearing aids would sound to someone with cochlear losses.
If you start on track 1, you’ll hear a musical version.
You can download your own copy of goldwave
at the bottom of the page there is an option to ‘try’ version 5
the principal controls are in the upper right hand corner of the screen.
They are the normal… play, record, stop buttons.
There are many other features in this program that allow many manipulations of sounds.
You do need a microphone to input any spoken elements.
The PC in RM 87 MSC will have one available.
Goldwave is installed on it.