Revision as of 12:21, 5 September 2008 by Apanja (Talk)

%ANANYA PANJA

%ECE 301

%Hail Purdue Chorus

A=220;

B=247;

Db=278;

D=294;

E=330;

F=349;

Gb=370;

G=392;

delta=.0005;

stop=.4;

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

t=0:delta:stop;

for i=length(Notes)

   Hail=sin(2*pi*t*Notes(i));
   sound(Hail,1/delta);

end

pause(3);

%To play the song twice as fast

for T=1:length(Notes)

   t=0:delta:.5*length(Notes(T));%.5 is the scaling factor
   Hail_1=sin(2*pi*t*Notes(T));
   sound(Hail_1,1/delta);

end

pause(3);

%To play the song at double frequency

for T=1:length(Notes)

   t=0:delta:length(Notes(T));
   Hail_2=sin(2*2*pi*t*Notes(T))%2 is the scaling here
   sound(Hail_2,1/delta);

end

Alumni Liaison

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

Alumni Liaison