clear all;

clc;

%Part 1: Smoke on the Water

%%%%%%%% Normal Rate %%%%%%%%

%Tempo

bpm = 112;

bps = 112/60;

spb = 1/bps;

%Sampling Rate

delta = 0.00005;

%Note Length

H = (0:delta:2*spb);

Q = (0:delta:spb);

E = (0:delta:0.5*spb);

DQ = (0:delta:1.5*spb);

%Notes

G = sin(2*pi*440*(2^(-2/12))*Q);

Bflat = sin(2*pi*440*(2^(1/12))*Q);

Cdq = sin(2*pi*440*(2^(3/12))*DQ);

Ch = sin(2*pi*440*(2^(3/12))*H);

Dflat = sin(2*pi*440*(2^(4/12))*E);


Song = [G, Bflat, Cdq, G, Bflat, Dflat, Ch, G, Bflat, Cdq, Bflat, G];

%%%%%%%% Rocking Out! %%%%%%%%

sound(Song, 1/delta);

wavwrite(Song, 1/delta, 'ECE301_HW1_1_A');

%%%%%%%% Faster Now! %%%%%%%%

H2 = H/2;

Q2 = Q/2;

E2 = E/2;

DQ2 = DQ/2;

%Notes

G = sin(2*pi*440*(2^(-2/12))*Q2);

Bflat = sin(2*pi*440*(2^(1/12))*Q2);

Cdq = sin(2*pi*440*(2^(3/12))*DQ2);

Ch = sin(2*pi*440*(2^(3/12))*H2);

Dflat = sin(2*pi*440*(2^(4/12))*E2);

Song = [G, Bflat, Cdq, G, Bflat, Dflat, Ch, G, Bflat, Cdq, Bflat, G];

%%%%%%%% Hit It! %%%%%%%%

sound(Song, 2/delta);

wavwrite(Song, 2/delta, 'ECE301_HW1_1_B');

%%%%%%%% Nail those high notes! %%%%%%%%

G = sin(2*pi*440*(2^(-2/12))*Q);

Bflat = sin(2*pi*440*(2^(1/12))*Q);

Cdq = sin(2*pi*440*(2^(3/12))*DQ);

Ch = sin(2*pi*440*(2^(3/12))*H);

Dflat = sin(2*pi*440*(2^(4/12))*E);

Song = [G, Bflat, Cdq, G, Bflat, Dflat, Ch, G, Bflat, Cdq, Bflat, G];

%%%%%%%% !m!_(>_<)_!m! %%%%%%%%

sound(Song, 2/delta);

wavwrite(Song, 2/delta, 'ECE301_HW1_1_C');

Media:ECE301_HW1_1_A.wav

Media:ECE301_HW1_1_B.wav

Media:ECE301_HW1_1_C.wav


% Part 2: Hidden Messages in Beatles song

%% Read in and play the original file

[Song,Fs] = wavread('Beatles.wav');

sound(Song,Fs);

%% Reverse the song, play the result, and write to file

Reverse = flipud(Song);

sound(Reverse,Fs);

wavwrite(Reverse,Fs,'Beatles_reverse')

Media:Beatles_reverse.wav

The original file sounds like "Number 9" being said repeatedly, while the reversed file sounds to me like "Let me on, Desmond" said repeatedly

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang