Line 1: Line 1:
% Shweta Saxena
+
=[[Homework_1_ECE301Fall2008mboutin|HW1]], [[ECE301]], Prof. [[user:mboutin|Boutin]]=
% ECE 301
+
In this homework assignment, we were asked to write a Matlab code to play the "Hail Purdue" song with different speeds and pitch.
%Registration number: 00224-61047
+
 
% Hail Purdue Chorus
+
----
 +
% Shweta Saxena
 +
% ECE 301
 +
  % Hail Purdue Chorus
  
 
clc;
 
clc;

Latest revision as of 10:03, 27 August 2010

HW1, ECE301, Prof. Boutin

In this homework assignment, we were asked to write a Matlab code to play the "Hail Purdue" song with different speeds and pitch.


% Shweta Saxena
% ECE 301
% 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

Sees the importance of signal filtering in medical imaging

Dhruv Lamba, BSEE2010