clc;
clear all;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
bpm = 112;
bps = bpm / 60;
spb = 1/bps;
delta = 0.00005;
t = 0:delta:3;
E = 0:delta:spb/2;
Q = 0:delta:spb;
H = 0:delta:spb*2;
DQ = 0:delta:3*spb/2;
E2 = 0:delta:spb/4;
Q2 = 0:delta:spb/2;
H2 = 0:delta:spb;
DQ2 = 0:delta:3*spb/4;
G = 391.995;
Bf = 466.164;
C = 523.251;
Df = 554.365;
smoke_on_water = [sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),...
sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*Df*E),sin(2*pi*C*H),...
sin(2*pi*G*Q),sin(2*pi*Bf*Q),sin(2*pi*C*DQ),sin(2*pi*Bf*Q),...
sin(2*pi*G*Q)];
smoke_on_water2 = [sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*C*DQ2),...
sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*Df*E2),sin(2*pi*C*H2),...
sin(2*pi*G*Q2),sin(2*pi*Bf*Q2),sin(2*pi*C*DQ2),sin(2*pi*Bf*Q2),...
sin(2*pi*G*Q2)];
sound(smoke_on_water,1/delta);
sound(smoke_on_water2,1/delta);
sound(smoke_on_water,2/delta);
wavwrite(smoke_on_water,1/delta,'ECEHW1_1_a');
wavwrite(smoke_on_water2,1/delta,'ECEHW1_1_b');
wavwrite(smoke_on_water,2/delta,'ECEHW1_1_c');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% PART 2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
[beatles, Fs] = wavread('Beatles.wav');
sound(beatles,Fs);
beatles_rev = flipud(beatles);
sound(beatles_rev,Fs);
wavwrite(beatles_rev,Fs,'ECEHW1_2_b');
Media:ECEHW1_1_a.wav
Media:ECEHW1_1_b.wav
Media:ECEHW1_1_c.wav