Recording

Below are three recordings of the first line of the chorus of the Purdue fight song.

a) Media:HailPurdue_ECE301Fall2008mboutin.ogg - Normal song

b) Media:HailPurdueDoubleTime_ECE301Fall2008mboutin.ogg - Played twice as fast

c) Media:HailPurdueTwiceAsHigh_ECE301Fall2008mboutin.ogg - Played one octave higher (I would recommend turning down your speakers, it's a little piercing)

Matlab Code

Hail Purdue

This code was written to play the three clips posted above.


clear
clc

%Sample rate
del=.00005;

%calculate frequencies for the notes in the range we need,
%starting with C (3 half steps below A(440Hz)
for i=3:14
    freq(i-2)=220*2^(i/12);
end

%Assign notes to each calculated frequency
C=freq(1);
Df=freq(2);
D=freq(3);
Ef=freq(4);
E=freq(5);
F=freq(6);
Gf=freq(7);
G=freq(8);
Af=freq(9);
A=freq(10);
Bf=freq(11);
B=freq(12);
hC=2*C;
hDf=2*Df;

%Assign note lengths (in seconds)
whole=2;
h=whole*.5;
q=whole*.25;
dq=q*1.5;
e=whole*.125;

%Arrays of notes and their respective lengths to be played
%key of A flat
notes=[Ef,F,G,Af,Bf,hC]; %Hail, hail to old Purdue!
time=[h,q,q,dq,e,q];

%a) Loop through arrays of notes and times to play the song at normal
%   speed
for i=1:length(notes)
    t=0:del:time(i);
    y=sin(2*pi*notes(i)*t);
    sound(y,1/del)
    pause(time(i));
end

pause(2)

%b) Play song twice as fast (done by cutting the length of the notes
%   in half
for i=1:length(notes)
    t=0:del:time(i)/2;  %divide time by 2
    y=sin(2*pi*notes(i)*t);
    sound(y,1/del)
    pause(time(i)/2);   %also divide pause time by 2
end

pause(2)

%c) Play signal corresponding to the tune of a) and rescale 
%   it according to the transformation y(t)=x(2t).  This plays
%   the song one octave higher (by doubling the frequency)

for i=1:length(notes)
    t=0:del:time(i);
    y=sin(2*pi*notes(i)*t*2); % Use t*2 instead of t
    sound(y,1/del)
    pause(time(i));
end

Alumni Liaison

To all math majors: "Mathematics is a wonderfully rich subject."

Dr. Paul Garrett