%Ellen Fissel
%ECE301
%1A Play Smoke on the water
delta=0.00005;
bpm=112;
spb=60/bpm; %seconds per beat
quarter=spb;
eighth=spb/2;
dottedq=spb*3/2;
half=spb*2;
qt=[0:delta:quarter]; %quarter time
et=[0:delta:eighth]; %eighth time
dqt=[0:delta:dottedq]; %dotted quarter time
ht=[0:delta:half]; %half time
G_q=sin(2*pi*392*qt); %G quarter time
Bf_q=sin(2*pi*466*qt); %B flat quarter time
C_dq=sin(2*pi*523*dqt); %C dotted quarter time
Df_e=sin(2*pi*554*et); %D flat eighth time
C_h=sin(2*pi*523*ht); %C half time
tune1=[G_q,Bf_q,C_dq,G_q,Bf_q,Df_e,C_h,G_q,Bf_q,C_dq,Bf_q,G_q];
wavwrite(tune1,20000,'smokeonthewater1A');
%1B Play Smoke on the water twice as fast
qt2=[0:delta:(quarter/2)]; %quarter time fast
et2=[0:delta:(eighth/2)]; %eighth time fast
dqt2=[0:delta:(dottedq/2)]; %dotted quarter time fast
ht2=[0:delta:(half/2)]; %half time fast
G_q2=sin(2*pi*392*qt2); %G quarter time
Bf_q2=sin(2*pi*466*qt2); %B flat quarter time
C_dq2=sin(2*pi*523*dqt2); %C dotted quarter time
Df_e2=sin(2*pi*554*et2); %D flat eighth time
C_h2=sin(2*pi*523*ht2); %C half time
tune2=[G_q2,Bf_q2,C_dq2,G_q2,Bf_q2,Df_e2,C_h2,G_q2,Bf_q2,C_dq2,Bf_q2,G_q2];
wavwrite(tune2,20000,'smokeonthewater1B');
%1C Play Smoke on the water with y(t)=x(2t)
G_q=sin(4*pi*392*qt); %G quarter time higher
Bf_q=sin(4*pi*466*qt); %B flat quarter time higher
C_dq=sin(4*pi*523*dqt); %C dotted quarter time higher
Df_e=sin(4*pi*554*et); %D flat eighth time higher
C_h=sin(4*pi*523*ht); %C half time higher
tune3=[G_q,Bf_q,C_dq,G_q,Bf_q,Df_e,C_h,G_q,Bf_q,C_dq,Bf_q,G_q];
wavwrite(tune3,20000,'smokeonthewater1C');
%2A
%Beatles song plays"number nine"
%2B
beatles=wavread('beatles.wav');
flip=flipud(beatles);
wavwrite(flip,40000,'flipped2B');
%Flipped says "turn me on dead man"