(Hw1_ECE301SS1_Matt Mabry)
 
Line 1: Line 1:
% Author: Matt Mabry<br>% Class: ECE 301<br>% Assignment: HW 1<br>% Date: January 19, 2011
 
  
% Part 1<br>% Description: Play the melody "Smoke on the Water" in three ways. One: in<br>% the original tune. Two: twice as fast. Three: Rescale the tune
+
% Author: Matt Mabry
 +
% Class: ECE 301
 +
% Assignment: HW 1
 +
% Date: January 19, 2011
  
clear all;<br>clc;
+
% Part 1
 +
% Description: Play the melody "Smoke on the Water" in three ways. One: in
 +
% the original tune. Two: twice as fast. Three: Rescale the tune
  
bps = 112/60; %beats per second<br>bt = bps^(-1); %time length of each beat
+
clear all;
 +
clc;  
  
delt = 5e-5; %Time span between each beat
+
bps = 112/60; %beats per second
 +
bt = bps^(-1); %time length of each beat  
  
% Part a: "Smoke on the Water" in normal speed
+
delt = 5e-5; %Time span between each beat
  
% Notes in "Smoke on the Water"<br>half = 0:delt:(bt*2);<br>quarter = 0:delt:bt;<br>dotquarter = 0:delt:(bt*3/2);<br>eighth = 0:delt:(bt/2);
+
% Part a: "Smoke on the Water" in normal speed
  
%Note Used<br>hc = sin(2*pi*(2^(1/4)*440)*half);<br>dqc = sin(2*pi*(2^(1/4)*440)*dotquarter);<br>hg = sin(2*pi*(2^(-1/6)*440)*half);<br>qg = sin(2*pi*(2^(-1/6)*440)*quarter);<br>qbf = sin(2*pi*(2^(1/12)*440)*quarter);<br>edf = sin(2*pi*(2^(1/3)*440)*eighth);
+
% Notes in "Smoke on the Water"
 +
half = 0:delt:(bt*2);
 +
quarter = 0:delt:bt;
 +
dotquarter = 0:delt:(bt*3/2);
 +
eighth = 0:delt:(bt/2);  
  
% Construction of Normal Song<br>Smoke = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg];<br>wavwrite(Smoke, 1/delt, 32, 'Smoke_normal.wav');<br>pause(6)
+
%Note Used
 +
hc = sin(2*pi*(2^(1/4)*440)*half);
 +
dqc = sin(2*pi*(2^(1/4)*440)*dotquarter);
 +
hg = sin(2*pi*(2^(-1/6)*440)*half);
 +
qg = sin(2*pi*(2^(-1/6)*440)*quarter);
 +
qbf = sin(2*pi*(2^(1/12)*440)*quarter);
 +
edf = sin(2*pi*(2^(1/3)*440)*eighth);
  
% Part b: "Smoke on the Water" in faster speed
+
% Construction of Normal Song
 +
Smoke = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg];
 +
sound(Smoke,1/delt)
 +
wavwrite(Smoke, 1/delt, 32, 'Smoke_normal.wav');
 +
pause(6)
  
% Notes in "Smoke on the Water"<br>half = 0:delt:bt;<br>quarter = 0:delt:(bt/2);<br>dotquarter = 0:delt:(bt*3/4);<br>eighth = 0:delt:(bt/4);
+
% Part b: "Smoke on the Water" in faster speed
  
%Note Used<br>hc = sin(2*pi*(2^(1/4)*440)*half);<br>dqc = sin(2*pi*(2^(1/4)*440)*dotquarter);<br>hg = sin(2*pi*(2^(-1/6)*440)*half);<br>qg = sin(2*pi*(2^(-1/6)*440)*quarter);<br>qbf = sin(2*pi*(2^(1/12)*440)*quarter);<br>edf = sin(2*pi*(2^(1/3)*440)*eighth);
+
% Notes in "Smoke on the Water"
 +
half = 0:delt:bt;
 +
quarter = 0:delt:(bt/2);
 +
dotquarter = 0:delt:(bt*3/4);
 +
eighth = 0:delt:(bt/4);  
  
% Construction of Faster Song<br>Smoke_Fast = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg];<br>wavwrite(Smoke_Fast, 1/delt, 32, 'Smoke_faster.wav');<br>pause(6)
+
%Note Used
 +
hc = sin(2*pi*(2^(1/4)*440)*half);
 +
dqc = sin(2*pi*(2^(1/4)*440)*dotquarter);
 +
hg = sin(2*pi*(2^(-1/6)*440)*half);
 +
qg = sin(2*pi*(2^(-1/6)*440)*quarter);
 +
qbf = sin(2*pi*(2^(1/12)*440)*quarter);
 +
edf = sin(2*pi*(2^(1/3)*440)*eighth);
  
% Part c: "Smoke on the Water" transformation to higher pitch
+
% Construction of Faster Song
 +
Smoke_Fast = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg];
 +
sound(Smoke_Fast,1/delt)
 +
wavwrite(Smoke_Fast, 1/delt, 32, 'Smoke_faster.wav');
 +
pause(6)
  
% Notes in "Smoke on the Water"<br>half = 0:delt:(bt*2);<br>quarter = 0:delt:bt;<br>dotquarter = 0:delt:(bt*3/2);<br>eighth = 0:delt:(bt/2);
+
% Part c: "Smoke on the Water" transformation to higher pitch
  
%Note Used<br>hc = sin(4*pi*(2^(1/4)*440)*half);<br>dqc = sin(4*pi*(2^(1/4)*440)*dotquarter);<br>hg = sin(4*pi*(2^(-1/6)*440)*half);<br>qg = sin(4*pi*(2^(-1/6)*440)*quarter);<br>qbf = sin(4*pi*(2^(1/12)*440)*quarter);<br>edf = sin(4*pi*(2^(1/3)*440)*eighth);
+
% Notes in "Smoke on the Water"
 +
half = 0:delt:(bt*2);
 +
quarter = 0:delt:bt;
 +
dotquarter = 0:delt:(bt*3/2);
 +
eighth = 0:delt:(bt/2);  
  
% Construction of Transformed Song<br>Smoke_Pitch = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg];<br>wavwrite(Smoke_Pitch, 1/delt, 32, 'Smoke_transformation.wav');<br>pause(6)<br>
+
%Note Used
 +
hc = sin(4*pi*(2^(1/4)*440)*half);
 +
dqc = sin(4*pi*(2^(1/4)*440)*dotquarter);
 +
hg = sin(4*pi*(2^(-1/6)*440)*half);
 +
qg = sin(4*pi*(2^(-1/6)*440)*quarter);
 +
qbf = sin(4*pi*(2^(1/12)*440)*quarter);
 +
edf = sin(4*pi*(2^(1/3)*440)*eighth);
  
 +
% Construction of Transformed Song
 +
Smoke_Pitch = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg];
 +
sound(Smoke_Pitch,1/delt)
 +
wavwrite(Smoke_Pitch, 1/delt, 32, 'Smoke_transformation.wav');
 +
pause(6)
  
  
Line 55: Line 104:
  
  
I wanted to attach my files, but I do not know how.&nbsp; I posted a link in the questions forum, so hopefully someone can help me out.
+
 
 +
 
 +
[[Media:Smoke_normal.wav]]
 +
 
 +
[[Media:Smoke_faster.wav]]
 +
 
 +
[[Media:Smoke_transformation.wav]]

Revision as of 08:47, 19 January 2011

% Author: Matt Mabry % Class: ECE 301 % Assignment: HW 1 % Date: January 19, 2011

% Part 1 % Description: Play the melody "Smoke on the Water" in three ways. One: in % the original tune. Two: twice as fast. Three: Rescale the tune

clear all; clc;

bps = 112/60; %beats per second bt = bps^(-1); %time length of each beat

delt = 5e-5; %Time span between each beat

% Part a: "Smoke on the Water" in normal speed

% Notes in "Smoke on the Water" half = 0:delt:(bt*2); quarter = 0:delt:bt; dotquarter = 0:delt:(bt*3/2); eighth = 0:delt:(bt/2);

%Note Used hc = sin(2*pi*(2^(1/4)*440)*half); dqc = sin(2*pi*(2^(1/4)*440)*dotquarter); hg = sin(2*pi*(2^(-1/6)*440)*half); qg = sin(2*pi*(2^(-1/6)*440)*quarter); qbf = sin(2*pi*(2^(1/12)*440)*quarter); edf = sin(2*pi*(2^(1/3)*440)*eighth);

% Construction of Normal Song Smoke = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg]; sound(Smoke,1/delt) wavwrite(Smoke, 1/delt, 32, 'Smoke_normal.wav'); pause(6)

% Part b: "Smoke on the Water" in faster speed

% Notes in "Smoke on the Water" half = 0:delt:bt; quarter = 0:delt:(bt/2); dotquarter = 0:delt:(bt*3/4); eighth = 0:delt:(bt/4);

%Note Used hc = sin(2*pi*(2^(1/4)*440)*half); dqc = sin(2*pi*(2^(1/4)*440)*dotquarter); hg = sin(2*pi*(2^(-1/6)*440)*half); qg = sin(2*pi*(2^(-1/6)*440)*quarter); qbf = sin(2*pi*(2^(1/12)*440)*quarter); edf = sin(2*pi*(2^(1/3)*440)*eighth);

% Construction of Faster Song Smoke_Fast = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg]; sound(Smoke_Fast,1/delt) wavwrite(Smoke_Fast, 1/delt, 32, 'Smoke_faster.wav'); pause(6)

% Part c: "Smoke on the Water" transformation to higher pitch

% Notes in "Smoke on the Water" half = 0:delt:(bt*2); quarter = 0:delt:bt; dotquarter = 0:delt:(bt*3/2); eighth = 0:delt:(bt/2);

%Note Used hc = sin(4*pi*(2^(1/4)*440)*half); dqc = sin(4*pi*(2^(1/4)*440)*dotquarter); hg = sin(4*pi*(2^(-1/6)*440)*half); qg = sin(4*pi*(2^(-1/6)*440)*quarter); qbf = sin(4*pi*(2^(1/12)*440)*quarter); edf = sin(4*pi*(2^(1/3)*440)*eighth);

% Construction of Transformed Song Smoke_Pitch = [qg,qbf,dqc,qg,qbf,edf,hc,qg,qbf,dqc,qbf,qg]; sound(Smoke_Pitch,1/delt) wavwrite(Smoke_Pitch, 1/delt, 32, 'Smoke_transformation.wav'); pause(6)




% Part 2
% Description: Reverse the Beatles song Number 9 and decode 'hidden
% message'

[song, fs, bits] = wavread('Beatles.wav');
sound(song, fs, bits)

pause(5)
%When played normally, it repeats the saying 'number 9'

%Now I reverse the sound

reverse = flipud(song);
sound(song, fs, bits)

% To me it sounds like gibberish, but it is notoriously known for saying
% "turn me on dead man"




Media:Smoke_normal.wav

Media:Smoke_faster.wav

Media:Smoke_transformation.wav

Alumni Liaison

has a message for current ECE438 students.

Sean Hu, ECE PhD 2009