Revision as of 19:45, 4 September 2008 by Huang122 (Talk)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

% Hail Purdue.

% XUJUN HUANG % huang122@purdue.edu

% note durations. % time signature = 4/4 % quarter note = 180bpm => quarter note duration is 60/180 minute. Q=60/180; H=2*Q; % Half note W=4*Q; % Whole note En=Q/2; %Eighth note DQ=Q+En; %Dotted quarter

%frequencies

% A=440 = 5x/3 => x=264 % Middle C (do) = x = 264; % D (re)=9x/8=297; % E (mi)=5x/4=330; % F (fa)=4x/3=352; % GL (so)=3x/2/2=198; % AL (low la)=5x/3/2=220; % BL (low ti)=15x/8/2=247.5;

C=264; D=297; E=330; F=352; GL=198; AL=220; BL=247.5;


notes = [GL,GL,AL,C,D,E,E,F,F,F,C,D,E,E,... %Hail, hail to old Purdue!All hail to our old gold and black! E,E,D,C,D,E,E,D,AL,BL,C,BL,AL,D,... %Hail, hail to old Purdue!Our friendship may she never lack, GL,GL,GL,AL,C,D,E,E,F,F,C,D,E,... %Ever grateful ever true,Thus we raise our song anew,† AL,BL,C,AL,GL,C,E,GL,AL,E,D,C,C]; %Of the days we've spent with you,All hail our own Purdue.

duration = [H,DQ,En,DQ,En,Q,Q,Q,En,En,Q,En,En,W,... H,DQ,En,DQ,En,Q,Q,Q,En,En,Q,En,En,W,... DQ,En,Q,Q,DQ,En,Q,Q,Q,Q,Q,Q,W,... DQ,En,Q,Q,Q,Q,Q,Q,DQ,En,DQ,En,W];

% Play the song as what demonstrated in class delta=0.00005;


for n = 1:56 t = 0:delta:duration(n); anthem = sin(2*pi*notes(n)*t); sound(anthem, 1/delta); end

Alumni Liaison

Have a piece of advice for Purdue students? Share it through Rhea!

Alumni Liaison