Line 44: Line 44:
 
Song = [G, Bflat, Cdq, G, Bflat, Dflat, Ch, G, Bflat, Cdq, Bflat, G];
 
Song = [G, Bflat, Cdq, G, Bflat, Dflat, Ch, G, Bflat, Cdq, Bflat, G];
  
%Rocking Out!
+
%%%%%%%% Rocking Out! %%%%%%%%
  
 
sound(Song, 1/delta);
 
sound(Song, 1/delta);
Line 74: Line 74:
 
Song = [G, Bflat, Cdq, G, Bflat, Dflat, Ch, G, Bflat, Cdq, Bflat, G];
 
Song = [G, Bflat, Cdq, G, Bflat, Dflat, Ch, G, Bflat, Cdq, Bflat, G];
  
%Hit It!
+
%%%%%%%% Hit It! %%%%%%%%
  
 
sound(Song, 2/delta);
 
sound(Song, 2/delta);

Latest revision as of 16:00, 17 January 2011

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

Basic linear algebra uncovers and clarifies very important geometry and algebra.

Dr. Paul Garrett