Revision as of 17:04, 18 January 2011 by Cwippich (Talk | contribs)

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

clc clear

fA = 440; %frequency of the 4th A note on a keyboard

delta = 0.00005 %timestep

tempo = 112/60;  %beats per second H = 0: delta: 2/tempo; %a half note is 2 beats Q = 0: delta: 1/tempo; %a quarter note is 1 beat E = 0: delta: 1/(2*tempo); %an eighth note is half a beat DQ =0: delta: 3/(2*tempo); %a dotted quarter note is 1 and 1/2 beats


QG = sin(2*pi*((2^(-2/12))*fA)*Q); %frequency of the G note is 2 half steps lower than A and is a quarter note

QBflat = sin(2*pi*((2^(1/12))*fA)*Q); %frequency of the bflat is 2 half steps above A and is a quarter note

DQC = sin(2*pi*((2^(3/12))*fA)*DQ); % C is 3 half steps above A and is a dotted quarter note

EDflat = sin(2*pi*((2^(4/12))*fA)*E); %frequency the dflat is 4 half steps above A and is an eighth note

HC = sin(2*pi*((2^(3/12))*fA)*H); %half note C

smoke = [QG, QBflat, DQC, QG, QBflat, EDflat, HC, QG, QBflat, DQC, QBflat, QG];

%number 1, section 1 tempo = 112/60;  %beats per second H = 0: delta: 2/tempo; %a half note is 2 beats Q = 0: delta: 1/tempo; %a quarter note is 1 beat E = 0: delta: 1/(2*tempo); %an eighth note is half a beat DQ =0: delta: 3/(2*tempo); %a dotted quarter note is 1 and 1/2 beats


QG = sin(2*pi*((2^(-2/12))*fA)*Q); %frequency of the G note is 2 half steps lower than A and is a quarter note

QBflat = sin(2*pi*((2^(1/12))*fA)*Q); %frequency of the bflat is 2 half steps above A and is a quarter note

DQC = sin(2*pi*((2^(3/12))*fA)*DQ); % C is 3 half steps above A and is a dotted quarter note

EDflat = sin(2*pi*((2^(4/12))*fA)*E); %frequency the dflat is 4 half steps above A and is an eighth note

HC = sin(2*pi*((2^(3/12))*fA)*H); %half note C

smoke = [QG, QBflat, DQC, QG, QBflat, EDflat, HC, QG, QBflat, DQC, QBflat, QG];

sound(smoke, 1/delta)

wavwrite(smoke, 1/delta,'hw1_section1')

Media:hw_1section1.wav

%number 1, section 2

tempo = 2* (112/60);  %beats per second H = 0: delta: 2/tempo; %a half note is 2 beats Q = 0: delta: 1/tempo; %a quarter note is 1 beat E = 0: delta: 1/(2*tempo); %an eighth note is half a beat DQ =0: delta: 3/(2*tempo); %a dotted quarter note is 1 and 1/2 beats


QG = sin(2*pi*((2^(-2/12))*fA)*Q); %frequency of the G note is 2 half steps lower than A and is a quarter note

QBflat = sin(2*pi*((2^(1/12))*fA)*Q); %frequency of the bflat is 2 half steps above A and is a quarter note

DQC = sin(2*pi*((2^(3/12))*fA)*DQ); % C is 3 half steps above A and is a dotted quarter note

EDflat = sin(2*pi*((2^(4/12))*fA)*E); %frequency the dflat is 4 half steps above A and is an eighth note

HC = sin(2*pi*((2^(3/12))*fA)*H); %half note C

smoke = [QG, QBflat, DQC, QG, QBflat, EDflat, HC, QG, QBflat, DQC, QBflat, QG];

sound(smoke, 1/delta) wavwrite(smoke, 1/delta,'hw1_section2')

Media:hw_1section2.wav

%number 1, section 3

tempo = 112/60;  %beats per second H = 0: delta: 2/tempo; %a half note is 2 beats Q = 0: delta: 1/tempo; %a quarter note is 1 beat E = 0: delta: 1/(2*tempo); %an eighth note is half a beat DQ =0: delta: 3/(2*tempo); %a dotted quarter note is 1 and 1/2 beats


QG = sin(2*2*pi*((2^(-2/12))*fA)*Q); %frequency of the G note is 2 half steps lower than A and is a quarter note

QBflat = sin(2*2*pi*((2^(1/12))*fA)*Q); %frequency of the bflat is 2 half steps above A and is a quarter note

DQC = sin(2*2*pi*((2^(3/12))*fA)*DQ); % C is 3 half steps above A and is a dotted quarter note

EDflat = sin(2*2*pi*((2^(4/12))*fA)*E); %frequency the dflat is 4 half steps above A and is an eighth note

HC = sin(2*2*pi*((2^(3/12))*fA)*H); %half note C

smoke = [QG, QBflat, DQC, QG, QBflat, EDflat, HC, QG, QBflat, DQC, QBflat, QG];

sound(smoke, 1/delta) wavwrite(smoke, 1/delta,'hw1_section3')

Media:hw_1section3.wav

  1. 2

clear all clc


[x,f] = wavread('Beatles.wav');  %wavread function to read the beatles file %sound(x,f); if this were not commented the file would play in the way it %was intended to be played originally y = flipud(x);  %the new variable y acts as a function within flipud to play the song backwards sound(y,f); %plays the song in reverse because of the change of variables wavwrite(y,f,'Backwards Beatles')

Media:Backwards Beatles.wav

%in forward play, the lyrics are "number nine, number nine, etc..." but in %reverse, the lyrics sound like "bring me on demand" however, internet %sources say it is supposed to sound like "turn me on dead man."

Alumni Liaison

Ph.D. 2007, working on developing cool imaging technologies for digital cameras, camera phones, and video surveillance cameras.

Buyue Zhang