(New page: #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: de...) |
|||
Line 49: | Line 49: | ||
sound(smoke, 1/delta) | sound(smoke, 1/delta) | ||
+ | wavwrite(smoke, 1/delta,'hw1_section1') | ||
+ | [[Media:Example.ogg]] | ||
%number 1, section 2 | %number 1, section 2 | ||
Line 73: | Line 75: | ||
sound(smoke, 1/delta) | sound(smoke, 1/delta) | ||
+ | wavwrite(smoke, 1/delta,'hw1_section2') | ||
Line 98: | Line 101: | ||
sound(smoke, 1/delta) | sound(smoke, 1/delta) | ||
+ | wavwrite(smoke, 1/delta,'hw1_section3') | ||
Line 111: | Line 115: | ||
y = flipud(x); %the new variable y acts as a function within flipud to play the song backwards | 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 | sound(y,f); %plays the song in reverse because of the change of variables | ||
+ | wavwrite(y,f,'Backwards Beatles') | ||
%in forward play, the lyrics are "number nine, number nine, etc..." but in | %in forward play, the lyrics are "number nine, number nine, etc..." but in | ||
%reverse, the lyrics sound like "bring me on demand" however, internet | %reverse, the lyrics sound like "bring me on demand" however, internet | ||
%sources say it is supposed to sound like "turn me on dead man." | %sources say it is supposed to sound like "turn me on dead man." |
Revision as of 16:56, 18 January 2011
- 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')
%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')
%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')
- 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')
%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."