Line 82: | Line 82: | ||
wavwrite(tune_reversed,Fs,'Beatles_reversed') | wavwrite(tune_reversed,Fs,'Beatles_reversed') | ||
%The reversed message is "turn me on, dead man." | %The reversed message is "turn me on, dead man." | ||
+ | |||
+ | [[Media:Beatles_reversed.wav]] |
Latest revision as of 06:38, 19 January 2011
%Melanie Gauci %ECE301 %January 18, 2011 %Homework #1
clear clc
%PART 1: Playing Music %1-1 BPS=(112/60); %beats per second delta=.00005; %time step
Q=0:delta:(1/BPS); %quarter note DQ=0:delta:((3/2)*(1/BPS)); %dotted quarter note E=0:delta:((1/BPS)/2); %eighth note H=0:delta:(2*(1/BPS)); %half note
freq_G=391.995; %frequency of note G freq_Bflat=466.164; %frequency of note Bflat freq_C=523.251; %frequency of note C freq_Dflat=544.365; %frequency of note Dflat
GQ=sin(2*pi*freq_G*Q); %G quarter note BflatQ=sin(2*pi*freq_Bflat*Q); %B flat quarter note CDQ=sin(2*pi*freq_C*DQ); %C dotted quarter note DflatE=sin(2*pi*freq_Dflat*E); %D flat eighth note CH=sin(2*pi*freq_C*H); %C half note
music=[GQ BflatQ CDQ GQ BflatQ DflatE CH GQ BflatQ CDQ BflatQ GQ]; %stores notes in matrix so that the song can be played together
sound(music, 1/delta) %plays song wavwrite(music, 1/delta, 'Smoke_on_the_Water')
%1-2 twiceQ=Q/2 %quarter note twice as fast twiceDQ=DQ/2 %dotted quarter note twice as fast twiceE=E/2 %eighth note twice as fast twiceH=H/2 %half note twice as fast
GQ=sin(2*pi*freq_G*twiceQ); %G quarter note BflatQ=sin(2*pi*freq_Bflat*twiceQ); %B flat quarter note CDQ=sin(2*pi*freq_C*twiceDQ); %C dotted quarter note DflatE=sin(2*pi*freq_Dflat*twiceE); %D flat eighth note CH=sin(2*pi*freq_C*twiceH); %C half note
music2=[GQ BflatQ CDQ GQ BflatQ DflatE CH GQ BflatQ CDQ BflatQ GQ]; %stores notes in matrix so that the song can be played together
sound(music2, 2/delta)%plays song twice as fast wavwrite(music2, 2/delta, 'Smoke_on_the_Water_2x')
Media:Smoke_on_the_Water_2x.wav
%1-3
Q=0:delta:(1/BPS); %quarter note
DQ=0:delta:((3/2)*(1/BPS)); %dotted quarter note
E=0:delta:((1/BPS)/2); %eighth note
H=0:delta:(2*(1/BPS)); %half note
GQ=sin(4*pi*freq_G*Q); %G quarter note BflatQ=sin(4*pi*freq_Bflat*Q); %B flat quarter note CDQ=sin(4*pi*freq_C*DQ); %C dotted quarter note DflatE=sin(4*pi*freq_Dflat*E); %D flat eighth note CH=sin(4*pi*freq_C*H); %C half note
music3=[GQ BflatQ CDQ GQ BflatQ DflatE CH GQ BflatQ CDQ BflatQ GQ]; %stores notes in matrix so that the song can be played together
sound(music3, 1/delta) %plays song at a higher pitch wavwrite(music3, 1/delta, 'Smoke_on_the_Water_higher_pitch')
Media:Smoke_on_the_Water_higher_pitch.wav
%Part 2: Hidden Backward Message %2-1: The forward repeated message is "number nine." %2-2 [tune,Fs]=wavread('Beatles.wav'); tune_reversed=flipud(tune) sound(tune_reversed,Fs); wavwrite(tune_reversed,Fs,'Beatles_reversed') %The reversed message is "turn me on, dead man."