% ECE301 HW1 % YeeChin, Chiam
% Playing Music % Part a
% Tempo bpm=112;
% Pitch fA=2*pi*440; fBb=(2^(1/12))*fA; fC=(2^(3/12))*fA; fG=(2^(-2/12))*fA; fDb=(2^(4/12))*fA;
% Length crotchet=0:0.00005:(60/bpm); d_crotchet=0:0.00005:(4*60/(3*bpm)); quaver=0:0.00005:(60/(2*bpm)); minim=0:0.00005:(2*60/bpm);
music=[sin(fG*crotchet),sin(fBb*crotchet),sin(fC*d_crotchet),sin(fG*crotchet),sin(fBb*crotchet),sin(fDb*quaver),sin(fC*minim),sin(fG*crotchet),sin(fBb*crotchet),sin(fC*d_crotchet),sin(fBb*crotchet),sin(fG*crotchet),sin(0:0.00005:(2.5*60/bpm))]; sound(music,1/0.00005) wavwrite(music,1/0.00005,'a.wav')
% Part b
% Tempo bpm=2*112;
% Length crotchet=0:0.00005:(60/bpm); d_crotchet=0:0.00005:(4*60/(3*bpm)); quaver=0:0.00005:(60/(2*bpm)); minim=0:0.00005:(2*60/bpm);
music=[sin(fG*crotchet),sin(fBb*crotchet),sin(fC*d_crotchet),sin(fG*crotchet),sin(fBb*crotchet),sin(fDb*quaver),sin(fC*minim),sin(fG*crotchet),sin(fBb*crotchet),sin(fC*d_crotchet),sin(fBb*crotchet),sin(fG*crotchet),sin(0:0.00005:(2.5*60/bpm))]; sound(music,1/0.00005) wavwrite(music,1/0.00005,'b.wav')
% Part c
% Tempo bpm=112;
% Length crotchet=0:0.00005:(60/bpm); d_crotchet=0:0.00005:(4*60/(3*bpm)); quaver=0:0.00005:(60/(2*bpm)); minim=0:0.00005:(2*60/bpm);
music=[sin(2*fG*crotchet),sin(2*fBb*crotchet),sin(2*fC*d_crotchet),sin(2*fG*crotchet),sin(2*fBb*crotchet),sin(2*fDb*quaver),sin(2*fC*minim),sin(2*fG*crotchet),sin(2*fBb*crotchet),sin(2*fC*d_crotchet),sin(2*fBb*crotchet),sin(2*fG*crotchet),sin(2*0:0.00005:(2.5*60/bpm))]; sound(music,1/0.00005) wavwrite(music,1/0.00005,'c.wav')
% Hidden Backward Message beatles=wavread('Beatles.wav'); rbeatles=flipud(beatles); sound(rbeatles,44100); wavwrite(rbeatles,44100,'reverse_beatles');
Forward: speech sounds like "number nine", background music is flipped on 00:16
Backward: speech sounds like "let me on the man"
Conclusion: Speech and BGM is not recorded at the same time, since the clip contains both forward and backward version of music, while there are no really clear messages from the speaker.