(New page: 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*sp...)
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
 
clear all;
 
clear all;
 +
 
clc;
 
clc;
  
Line 7: Line 8:
  
 
%Tempo
 
%Tempo
 +
 
bpm = 112;
 
bpm = 112;
 +
 
bps = 112/60;
 
bps = 112/60;
 +
 
spb = 1/bps;
 
spb = 1/bps;
  
 
%Sampling Rate
 
%Sampling Rate
 +
 
delta = 0.00005;
 
delta = 0.00005;
 
    
 
    
 
%Note Length
 
%Note Length
 +
 
H = (0:delta:2*spb);
 
H = (0:delta:2*spb);
 +
 
Q = (0:delta:spb);
 
Q = (0:delta:spb);
 +
 
E = (0:delta:0.5*spb);
 
E = (0:delta:0.5*spb);
 +
 
DQ = (0:delta:1.5*spb);
 
DQ = (0:delta:1.5*spb);
  
 
%Notes
 
%Notes
 +
 
G = sin(2*pi*440*(2^(-2/12))*Q);
 
G = sin(2*pi*440*(2^(-2/12))*Q);
 +
 
Bflat = sin(2*pi*440*(2^(1/12))*Q);
 
Bflat = sin(2*pi*440*(2^(1/12))*Q);
 +
 
Cdq = sin(2*pi*440*(2^(3/12))*DQ);
 
Cdq = sin(2*pi*440*(2^(3/12))*DQ);
 +
 
Ch = sin(2*pi*440*(2^(3/12))*H);
 
Ch = sin(2*pi*440*(2^(3/12))*H);
 +
 
Dflat = sin(2*pi*440*(2^(4/12))*E);
 
Dflat = sin(2*pi*440*(2^(4/12))*E);
 +
  
 
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);
 +
 
wavwrite(Song, 1/delta, 'ECE301_HW1_1_A');
 
wavwrite(Song, 1/delta, 'ECE301_HW1_1_A');
  
Line 36: Line 53:
  
 
H2 = H/2;
 
H2 = H/2;
 +
 
Q2 = Q/2;
 
Q2 = Q/2;
 +
 
E2 = E/2;
 
E2 = E/2;
 +
 
DQ2 = DQ/2;
 
DQ2 = DQ/2;
  
 
%Notes
 
%Notes
 +
 
G = sin(2*pi*440*(2^(-2/12))*Q2);
 
G = sin(2*pi*440*(2^(-2/12))*Q2);
 +
 
Bflat = sin(2*pi*440*(2^(1/12))*Q2);
 
Bflat = sin(2*pi*440*(2^(1/12))*Q2);
 +
 
Cdq = sin(2*pi*440*(2^(3/12))*DQ2);
 
Cdq = sin(2*pi*440*(2^(3/12))*DQ2);
 +
 
Ch = sin(2*pi*440*(2^(3/12))*H2);
 
Ch = sin(2*pi*440*(2^(3/12))*H2);
 +
 
Dflat = sin(2*pi*440*(2^(4/12))*E2);
 
Dflat = sin(2*pi*440*(2^(4/12))*E2);
  
 
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);
 +
 
wavwrite(Song, 2/delta, 'ECE301_HW1_1_B');
 
wavwrite(Song, 2/delta, 'ECE301_HW1_1_B');
  
Line 56: Line 83:
  
 
G = sin(2*pi*440*(2^(-2/12))*Q);
 
G = sin(2*pi*440*(2^(-2/12))*Q);
 +
 
Bflat = sin(2*pi*440*(2^(1/12))*Q);
 
Bflat = sin(2*pi*440*(2^(1/12))*Q);
 +
 
Cdq = sin(2*pi*440*(2^(3/12))*DQ);
 
Cdq = sin(2*pi*440*(2^(3/12))*DQ);
 +
 
Ch = sin(2*pi*440*(2^(3/12))*H);
 
Ch = sin(2*pi*440*(2^(3/12))*H);
 +
 
Dflat = sin(2*pi*440*(2^(4/12))*E);
 
Dflat = sin(2*pi*440*(2^(4/12))*E);
  
Line 64: Line 95:
  
 
%%%%%%%% !m!_(>_<)_!m! %%%%%%%%
 
%%%%%%%% !m!_(>_<)_!m! %%%%%%%%
 +
 
sound(Song, 2/delta);
 
sound(Song, 2/delta);
 +
 
wavwrite(Song, 2/delta, 'ECE301_HW1_1_C');
 
wavwrite(Song, 2/delta, 'ECE301_HW1_1_C');
  
Line 80: Line 113:
  
 
[Song,Fs] = wavread('Beatles.wav');
 
[Song,Fs] = wavread('Beatles.wav');
 +
 
sound(Song,Fs);
 
sound(Song,Fs);
  
Line 85: Line 119:
  
 
Reverse = flipud(Song);
 
Reverse = flipud(Song);
 +
 
sound(Reverse,Fs);
 
sound(Reverse,Fs);
 +
 
wavwrite(Reverse,Fs,'Beatles_reverse')
 
wavwrite(Reverse,Fs,'Beatles_reverse')
  

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

Meet a recent graduate heading to Sweden for a Postdoctorate.

Christine Berkesch