%Satya Hegde %HW 1, Problem 4 Part (a)
%A has a frequency of 440 Hz. Using the table provided, note A has a %frquency of 5x/3, where x is the frequency of middle C. %Thus 5x/3 = 440, yielding %x = 264Hz
x = 264;
del = 0.0001;
t = 0:del:1; %definition of time vector
%Definition of Notes based on frequencies
C = sin(2*pi*x.*t);
E = sin(2*pi*(5*x/4).*t);
G = sin(2*pi*(3*x/2).*t);
%Lower notes each have a frequency equalling half their higher-octave %counterpart (ex.: G = 3x/2, so Gl = 3x/4)
Gl = sin(2*pi*(3*x/4).*t);
El = sin(2*pi*(5*x/8).*t);
Al = sin(2*pi*(5*x/6).*t);
Als = sin(2*pi*233.08.*t); %Given
Bl = sin(2*pi*(15*x/16).*t);
%Playing of Mario Brothers
sound(E,1/del)
sound(E,1/del)
sound(E,1/del)
sound(G,1/del)
sound(C,1/del)
sound(E,1/del)
sound(G,1/del)
sound(C,1/del)
sound(Gl,1/del)
sound(El,1/del)
sound(Al,1/del)
sound(Bl,1/del)
sound(Als,1/del)
sound(Al,1/del)