Line 1: | Line 1: | ||
%ANANYA PANJA | %ANANYA PANJA | ||
+ | |||
%ECE 301 | %ECE 301 | ||
+ | |||
%Hail Purdue Chorus | %Hail Purdue Chorus | ||
Line 24: | Line 26: | ||
Notes=[A,B,Db,D,E,Gb,Gb,G,G,G,D,E,F,Gb]; | Notes=[A,B,Db,D,E,Gb,Gb,G,G,G,D,E,F,Gb]; | ||
+ | |||
t=0:delta:stop; | t=0:delta:stop; | ||
for i=length(Notes) | for i=length(Notes) | ||
+ | |||
Hail=sin(2*pi*t*Notes(i)); | Hail=sin(2*pi*t*Notes(i)); | ||
+ | |||
sound(Hail,1/delta); | sound(Hail,1/delta); | ||
end | end | ||
pause(3); | pause(3); | ||
+ | |||
%To play the song twice as fast | %To play the song twice as fast | ||
for T=1:length(Notes) | for T=1:length(Notes) | ||
+ | |||
t=0:delta:.5*length(Notes(T));%.5 is the scaling factor | t=0:delta:.5*length(Notes(T));%.5 is the scaling factor | ||
+ | |||
Hail_1=sin(2*pi*t*Notes(T)); | Hail_1=sin(2*pi*t*Notes(T)); | ||
+ | |||
sound(Hail_1,1/delta); | sound(Hail_1,1/delta); | ||
end | end | ||
pause(3); | pause(3); | ||
+ | |||
%To play the song at double frequency | %To play the song at double frequency | ||
for T=1:length(Notes) | for T=1:length(Notes) | ||
+ | |||
t=0:delta:length(Notes(T)); | t=0:delta:length(Notes(T)); | ||
+ | |||
Hail_2=sin(2*2*pi*t*Notes(T))%2 is the scaling here | Hail_2=sin(2*2*pi*t*Notes(T))%2 is the scaling here | ||
+ | |||
sound(Hail_2,1/delta); | sound(Hail_2,1/delta); | ||
+ | |||
end | end |
Revision as of 12:21, 5 September 2008
%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