Revision as of 16:49, 3 September 2008 by Johns311 (Talk)

%Tyler Johnson
%September 3rd, 2008
%clear memory
clear;
%clear console
clc;

%Frequencies for each note
%using the frequencies from the homework page, the A note will have a frequency of 440 Hz
%some of the frequencies from the homework page didn't sound right, so I used frequency values from my friend that sounded better

x = 264;  
UC = 2*x  %523
B  =(15*x)/8  %493
A  =415  %(5*x)/3  % 415
G  =(3*x)/2  %392
F  =(4*x)/3  %349
E  =311   %(5*x)/4 %311
D  =(17*x)/8 %554
MC =x 

%Length of note
delta = .00005;
EI = .125; %Eigth Note
Q = .25; %Quarter Note
H = .5; %Half Note
T = .75; %Three Quarters Note
W = 1; %Whole Note

%Song verticies
%Song plays "Hail Hail to old Purdue! All hail to our old gold and black"

Notes = [E, F, G, A, B, UC, UC, D, D, D, A, B, B, UC];

Lengths = [H, Q, Q, Q+EI, EI, Q, Q, Q, EI, EI, Q, EI, EI, H+Q];

for counter = 1:14
    t=0:delta:Lengths(counter);
    d=sin(2*pi*t*Notes(counter));
    sound(d,1/delta);
end

pause(2);
%Play twice as fast

for counter = 1:14
    t=0:delta:Lengths(counter)/2;
    d=sin(2*pi*t*Notes(counter));
    sound(d,1/delta);
end

pause(2);
%Rescaled

for counter = 1:14
    t=0:delta:Lengths(counter);
    d=sin(2*pi*(t*2)*Notes(counter));
    sound(d,1/delta);
end

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood