Line 25: Line 25:
  
 
delta=0.0005;
 
delta=0.0005;
 +
 
stop=0.4;
 
stop=0.4;
 +
 
notes=[A,B,C,Db,D,E,Gb,gB,G,G,D,E,F,Gb];
 
notes=[A,B,C,Db,D,E,Gb,gB,G,G,D,E,F,Gb];
 +
 
t=0:delta:stop;
 
t=0:delta:stop;
 +
 
for i=length(notes)
 
for i=length(notes)
 
     x=sin(2*pi*t*notes(i));
 
     x=sin(2*pi*t*notes(i));
Line 34: Line 38:
  
 
pause(4);
 
pause(4);
 +
 +
 
% to play the song twice as fast
 
% to play the song twice as fast
 
for T=1:length(notes);
 
for T=1:length(notes);
Line 41: Line 47:
 
end
 
end
  
pause(4)
+
pause(4);
 
% to play the song with double frequency
 
% to play the song with double frequency
 
for T=1:length(notes)
 
for T=1:length(notes)

Revision as of 13:34, 5 September 2008

% Shweta Saxena % ECE 301 %Registration number: 00224-61047 % Hail Purdue Chorus

clc;

A=220;

B=247;

C=261.94;

Db=277;

D=294;

E=329.77;

F=349.13;

Gb=370;

G=392;

delta=0.0005;

stop=0.4;

notes=[A,B,C,Db,D,E,Gb,gB,G,G,D,E,F,Gb];

t=0:delta:stop;

for i=length(notes)

   x=sin(2*pi*t*notes(i));

sound(x,i/delta); end

pause(4);


% to play the song twice as fast for T=1:length(notes);

   t=0:delta:.5*lenght(notes(T));
   Y=sin(2*pi*t*notes(T));
   sound(Y,1/delta);

end

pause(4); % to play the song with double frequency for T=1:length(notes)

   t=0:delta:length(notes(T));
   Z=(sin(2*2*pi*t*notes(T))
   sound(Z,1/delta)

end

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood