(Hw1_ECE301SS1_Matt Mabry)
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
% Author: Matt Mabry<br>% Class: ECE 301<br>% Assignment: HW 1<br>% Date: January 19, 2011
+
% Author: Matt Mabry&nbsp;% Class: ECE 301&nbsp;% Assignment: HW 1&nbsp;% 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
+
% Part 1&nbsp;% Description: Play the melody "Smoke on the Water" in three ways. One: in&nbsp;% the original tune. Two: twice as fast. Three: Rescale the tune  
  
clear all;<br>clc;
+
clear all; clc;  
  
bps = 112/60; %beats per second<br>bt = bps^(-1); %time length of each beat
+
bps = 112/60;&nbsp;%beats per second bt = bps^(-1);&nbsp;%time length of each beat  
  
delt = 5e-5; %Time span between each beat
+
delt = 5e-5;&nbsp;%Time span between each beat  
  
% Part a: "Smoke on the Water" in normal speed
+
% Part a: "Smoke on the Water" in normal speed  
  
% 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);
+
% 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<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);
+
%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<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)
+
% 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
+
% Part b: "Smoke on the Water" in faster speed  
  
% 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);
+
% 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<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);
+
%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<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)
+
% 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
+
% Part c: "Smoke on the Water" transformation to higher pitch  
  
% 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);
+
% 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<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);
+
%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<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>
+
% 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<br>% Description: Reverse the Beatles song Number 9 and decode 'hidden message'
  
 +
[song, fs, bits] = wavread('Beatles.wav');<br>sound(song, fs, bits)
  
 +
pause(5)
  
 
+
%When played normally, it repeats the saying 'number 9'
% Part 2<br>% Description: Reverse the Beatles song Number 9 and decode 'hidden<br>% message'
+
 
+
[song, fs, bits] = wavread('Beatles.wav');<br>sound(song, fs, bits)
+
 
+
pause(5)<br>%When played normally, it repeats the saying 'number 9'
+
  
 
%Now I reverse the sound
 
%Now I reverse the sound
  
reverse = flipud(song);<br>sound(song, fs, bits)
+
reverse = flipud(song);<br>sound(reverse, fs, bits)<br>wavwrite(reverse,fs,32,'Reverse_Beatles.wav');<br>pause(5)
  
% To me it sounds like gibberish, but it is notoriously known for saying<br>% "turn me on dead man"
+
% To me it sounds like gibberish, but it is notoriously known for saying&lt;br&gt;% "turn me on dead man"
  
 +
<br>
  
 +
[[Media:Smoke_normal.wav]]
  
 +
[[Media:Smoke_faster.wav]]
  
 +
[[Media:Smoke_transformation.wav]]
  
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:Reverse_Beatles.wav]]

Latest revision as of 09:06, 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(reverse, fs, bits)
wavwrite(reverse,fs,32,'Reverse_Beatles.wav');
pause(5)

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


Media:Smoke_normal.wav

Media:Smoke_faster.wav

Media:Smoke_transformation.wav

Media:Reverse_Beatles.wav

Alumni Liaison

Sees the importance of signal filtering in medical imaging

Dhruv Lamba, BSEE2010