%Jonathan Morales
%09/05/2008
%ECE301 HW1.1

%Plays some of the mario bros song instead of the hail purdue because you might get 
%tired of hearing it over and over again

%Given
delta = 0:.000125:.125;
p=sin(0*delta);
c=sin(2*pi*130.81*delta);
dp=sin(2*pi*138.59*delta);
d=sin(2*pi*146.83*delta);
ep=sin(2*pi*155.56*delta);
e=sin(2*pi*164.81*delta);
f=sin(2*pi*174.61*delta);
gp=sin(2*pi*185*delta);
g=sin(2*pi*196*delta);
ap=sin(2*pi*207.65*delta);
a=sin(2*pi*220*delta);
bp=sin(2*pi*233.08*delta);
b=sin(2*pi*246.94*delta);
c1=sin(2*pi*261.63*delta);
dp1=sin(2*pi*277.18*delta);
d1=sin(2*pi*293.66*delta);
ep1=sin(2*pi*311.13*delta);
e1=sin(2*pi*329.63*delta);
f1=sin(2*pi*349.23*delta);
gp1=sin(2*pi*369.99*delta);
g1=sin(2*pi*392*delta);
ap1=sin(2*pi*415.3*delta);
a1=sin(2*pi*440*delta);
bp1=sin(2*pi*466.16*delta);
b1=sin(2*pi*493.88*delta);

%The notes in the song
line= [e1,e1,e1,e1,p,c1,e1,e1,g1,g1,g1,g1, p, p, p, p,c1,c1,c1, g, p, p, e,e,p];
line1=[ a, a, b,p,bp, a, a, g, g, p,e1,e1,g1,a1,a1,f1,g1, p,e1,e1,c1,d1,b,b,b];

%combines the notes
note = [line line1];

%makes the sound
sound(note);

%makes the file titled as mario
song=[line,line1];
wavwrite(song,'Mario');

%to make the song twice as fast make delta faster
delta = 0:.000125*2:.125;

%to have y(t) = x(2t) we just multiply delta by 2
delta = delta*2;

Alumni Liaison

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett