AMATH 482-582 Homework 2 G´abor transforms solved

Original price was: $35.00.Current price is: $30.00.



5/5 - (1 vote)

Part I

In this homework, you will analyze a portion of Handel’s Messiah with time-frequency analysis.
To get started, you can use the following commands (note that Handel is so highly regarded, that
MATLAB has a portion of his music already in MATLAB! I’m sure they’ll add some Beyonce and
T-Swift at some point, but you’ll have to suffer Handel for now):

load handel
v = y’/2;
xlabel(’Time [sec]’);
title(’Signal of Interest, v(n)’);

This code gives you plots the portion of music you will analyze. To play this back in MATLAB, you
can use the following commands:
p8 = audioplayer(v,Fs);
This homework is rather open ended in the sense that I want you to explore the timefrequency signature of this 9 second piece of classic work.

Things you should think aboutdoing:

1. Through use of the G´abor filtering we used in class, produce spectrograms of the piece of work.
2. Explore the window width of the G´abor transform and how it effects the spectrogram.
3. Explore the spectrogram and the idea of oversampling (i.e. using very small translations of
the G´abor window) versus potential undersampling (i.e. using very course/large translations
of the G´abor window).
4. Use different G´abor windows. Perhaps you can start with the Gaussian window, and look to
see how the results are effected with the Mexican hat wavelet and a step-function (Shannon)

Don’t be cheap on time here, i.e. don’t be lame. This is an opportunity for you to have a creative
and open ended experience with MATLAB and data analysis. Please do a nice job writing things up
and labeling your resulting plots. I believe this homework can be a really engaging and educational
experience if you devote some time to it.

Part II

From the website, download the two files music1.wav and music2wav. These files play the
song Mary had a little lamb on both the recorder and piano. These are .wav files I generated using
my iPhone. To important and convert them, use the following commands for both pieces (NOTE:
basically both pieces are converted to a vector representing the music, thus you can easily edit the
music by modifying the vector).

Figure 1: Music scale along with frequency of each note in Hz
tr_piano=16; % record time in seconds
y=wavread(’music1’); Fs=length(y)/tr_piano;
xlabel(’Time [sec]’); ylabel(’Amplitude’);
title(’Mary had a little lamb (piano)’); drawnow
p8 = audioplayer(y,Fs); playblocking(p8);

tr_rec=14; % record time in seconds
y=wavread(’music2’); Fs=length(y)/tr_rec;
xlabel(’Time [sec]’); ylabel(’Amplitude’);
title(’Mary had a little lamb (recorder)’);
p8 = audioplayer(y,Fs); playblocking(p8);

1. Through use of the G´abor filtering we used in class, reproduce the music score for this simple
piece. See Fig. 1 which has the music scale in Hertz. (note: to get a good clean score, you
may want to filter out overtones… see below).
2. What is the difference between a recorder and piano? Can you see the difference in the timefrequency analysis? Note that many people talk about the difference of instruments being
related to the timbre of an instrument.

The timbre is related to the overtones generated by
the instrument for a center frequency. Thus if you are playing a note at frequency ω0, an
instrument will generate overtones at 2ω0, 3ω0, · · · and so forth.