% 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