(Hw1_ECE301SS1_Matt Mabry) |
|||
Line 1: | Line 1: | ||
− | |||
− | % | + | % 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) | ||
Line 55: | Line 104: | ||
− | + | ||
+ | |||
+ | [[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"