Revision as of 10:16, 17 January 2011 by Mrmabry (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

% 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];
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];
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];
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"



I wanted to attach my files, but I do not know how.  I posted a link in the questions forum, so hopefully someone can help me out.

Alumni Liaison

Abstract algebra continues the conceptual developments of linear algebra, on an even grander scale.

Dr. Paul Garrett