%ECE 301 Homework 1 %Nicole Samuelson %January 19, 2011 %======================================================================== %Playing Music x = 0; for BPS = [112/60, 2*112/60, 112/60];
x = x+1; beat = 1/BPS; %total time for one quarter note delta = 0.00005; Q = 0:delta:beat; %quarter note H = 0:delta:(beat*2); %half note E = 0:delta:(beat/2); %eight note DQ = 0:delta:(beat*1.5); %dotted quarter note
Ao = 2*pi*440; %A frequency Go = 2^(-2/12)*Ao; %G frequency Bfo = 2^(1/12)*Ao; %B-flat frequency Co = 2^(3/12)*Ao; %C frequency Dfo = 2^(4/12)*Ao; %D-flat frequency
G = sin(Go*Q); %quarter note G Bf = sin(Bfo*Q); %quarter note Bf C1 = sin(Co*DQ); %dotted quarter note C Df = sin(Dfo*E); %eight note Df C2 = sin(Co*H); %half note C
smoke = [G, Bf, C1, G, Bf, Df, C2, G, Bf, C1, Bf, G]; if x ==1 %Song as written sound(smoke, 1/delta) wavwrite(smoke, 1/delta, 'ns_reg_smoke') elseif x ==2 %song two times faster sound(smoke, 1/delta) wavwrite(smoke, 1/delta, 'ns_fast_smoke') else %Song rescaled with c = 2 sound(smoke, 2/delta) wavwrite(smoke, 2/delta, 'ns_2x_smoke') end
end %========================================================================= %Hidden Backward Message [beatles, Fs]=wavread('Beatles.wav'); flipped = flipud(beatles); sound(flipped, Fs) wavwrite(flipped, Fs, 'ns_beatlesback') %It sounds like the hidden message is 'Turn me on, Edmond' or 'Turn me on, %dead man'
Media:Ns_2x_smoke.wav
Media:Ns_reg_smoke.wav
Media:Ns_fast_smoke.wav
Media:Ns_beatlesback.wav