Revision as of 16:42, 3 September 2008 by Drecord (Talk)

% Homework 1.1 Hail Purdue
%David Record
%September 3rd 2008

%%Song Notes and Lyrics:
%%http://www.purdue.edu/bands/media/Sounds/aamb/Hail%20Purdue%20Piano%20Sheet.pdf

%Lyrics
%Hail, to Old Purdue, All hail to our gold and black!

%Notes:
%E, F, G, A_, B_, C5, D5_, B

%Corresponding Frequencies: http://www.phy.mtu.edu/~suits/notefreqs.html
E   = 311.13; %HZ
F   = 349.23; %HZ
G   = 392.00; %HZ
A_  = 415.30; %HZ
B_  = 466.16; %HZ
C5  = 523.25; %HZ
D5_ = 554.37; %HZ
B   = 493.3;  %HZ

%Durations
delta = 0.00005; %As defined in class
quarter = .25;  %Quarter Note
half = .5;      %Half Note
whole = 1;      %Whole Note
eigth = .125;  %Eighth Note

notes = [E, F, G, A_, B_, C5, C5, D5_, D5_, D5_, A_, B_, B, C5];
durations = [half, quarter, quarter, (quarter+eighth), eighth, quarter, quarter, quarter, eighth, eighth, quarter, eigth, eigth, (half+quarter) ];

%%% Song Unaltered %%%
for counter = 1: length(notes)
    t = 0:delta:durations(counter);
    y = sin(2*pi*notes(counter)*t);
    sound (y, 1/delta);
end

%%% Twice as Fast %%%
for counter = 1: length(notes)
    t = 0:delta:durations(counter)/2;
    y = sin(2*pi*notes(counter)*t);
    sound (y, 1/delta);
end

%%% y(t) = x(2t) %%% Doubles the Frequency of the notes
for counter = 1: length(notes)
    t = 0:delta:durations(counter);
    y = sin(2*pi*notes(counter)*t*2);
    sound (y, 1/delta);
end

Alumni Liaison

Prof. Math. Ohio State and Associate Dean
Outstanding Alumnus Purdue Math 2008

Jeff McNeal