%%ECE 301 HW1
%%Aziz Smagulov
%% Playing music problem
%%1)
deltat = 0.00005;
%%Determine the length of each note
H = 0:deltat:(60/112*2); Q = 0:deltat:(60/112); E = 0:deltat:(60/112/2); DQ = 0:deltat:(60/112*1.5);
%%Determine the frequency of each note
Bffreq = 2^(1/12)*440; Cfreq = 2^(3/12)*440; Dffreq = 2^(4/12)*440; Gfreq = 2^(-2/12)*440;
%%Generate notes
GQ = sin(2*pi*Gfreq*Q); BfQ = sin(2*pi*Bffreq*Q); CDQ = sin(2*pi*Cfreq*DQ); DfE = sin(2*pi*Dffreq*E); CH = sin(2*pi*Cfreq*H);
%%Make music
music = [GQ,BfQ,CDQ,GQ,BfQ,DfE,CH,GQ,BfQ,CDQ,BfQ,GQ]; sound(music,1/deltat);
wavwrite(music,1/deltat,'azizhw1a.wav');
pause(3);
%%2)
deltat = 0.00005;
%%Determine the length of each note
H = 0:deltat:(60/112*2/2); Q = 0:deltat:(60/112/2); E = 0:deltat:(60/112/2/2); DQ = 0:deltat:(60/112*1.5/2);
%%Determine the frequency of each note
Bffreq = 2^(1/12)*440; Cfreq = 2^(3/12)*440; Dffreq = 2^(4/12)*440; Gfreq = 2^(-2/12)*440;
%%Generate notes
GQ = sin(2*pi*Gfreq*Q); BfQ = sin(2*pi*Bffreq*Q); CDQ = sin(2*pi*Cfreq*DQ); DfE = sin(2*pi*Dffreq*E); CH = sin(2*pi*Cfreq*H);
%%Make music
music = [GQ,BfQ,CDQ,GQ,BfQ,DfE,CH,GQ,BfQ,CDQ,BfQ,GQ]; sound(music,1/deltat);
wavwrite(music,1/deltat,'azizhw1b.wav');
pause(3);
%%3)
deltat = 0.00005;
%%Determine the length of each note
H = 0:deltat:(60/112*2); Q = 0:deltat:(60/112); E = 0:deltat:(60/112/2); DQ = 0:deltat:(60/112*1.5);
%%Determine the frequency of each note
Bffreq = 2^(1/12)*880; Cfreq = 2^(3/12)*880; Dffreq = 2^(4/12)*880; Gfreq = 2^(-2/12)*880;
%%Generate notes
GQ = sin(2*pi*Gfreq*Q); BfQ = sin(2*pi*Bffreq*Q); CDQ = sin(2*pi*Cfreq*DQ); DfE = sin(2*pi*Dffreq*E); CH = sin(2*pi*Cfreq*H);
%%Make music
music = [GQ,BfQ,CDQ,GQ,BfQ,DfE,CH,GQ,BfQ,CDQ,BfQ,GQ]; sound(music,1/deltat);
wavwrite(music,1/deltat,'azizhw1c.wav');
pause(3);
%%Hidden Backward Message Problem
[beatles, Fs] = wavread('Beatles.wav'); sound(beatles, Fs)
%%repeats "number nine"
pause(3);
reverse_beatles = flipud(beatles); sound(reverse_beatles,Fs);
%%"let me on dead man" that's what sounds to me
wavwrite(reverse_beatles,Fs,'reverse_beatles.wav');
pause(3);
Media:azizhw1a.wav Media:azizhw1b.wav Media:azizhw1c.wav Media:reverse_beatles.wav