(New page: % 5x/6 = 440 x = 440*6/5; % solve for x E = 5*x /8; % Middle E G = 3*x /4; % middle G C = x; % middle C GL = 3*x/8; % Lower G EL = 5*x/16; % LOwer E AL = 5*x/12; % lower A ...) |
|||
Line 1: | Line 1: | ||
% 5x/6 = 440 | % 5x/6 = 440 | ||
+ | |||
x = 440*6/5; % solve for x | x = 440*6/5; % solve for x | ||
E = 5*x /8; % Middle E | E = 5*x /8; % Middle E | ||
+ | |||
G = 3*x /4; % middle G | G = 3*x /4; % middle G | ||
+ | |||
C = x; % middle C | C = x; % middle C | ||
+ | |||
GL = 3*x/8; % Lower G | GL = 3*x/8; % Lower G | ||
+ | |||
EL = 5*x/16; % LOwer E | EL = 5*x/16; % LOwer E | ||
+ | |||
AL = 5*x/12; % lower A | AL = 5*x/12; % lower A | ||
+ | |||
BL = 15*x/36; % lower B | BL = 15*x/36; % lower B | ||
− | |||
+ | ALS = 233.08; % lower A# | ||
del = 0.0001; % 12 notes , 2500 for each | del = 0.0001; % 12 notes , 2500 for each | ||
+ | |||
t = 0:del:3.5; % total length 35001 | t = 0:del:3.5; % total length 35001 | ||
% time for Note E | % time for Note E | ||
+ | |||
t1 = [ones(1,7500), zeros(1,5000),ones(1,2500),zeros(1,20001)]; | t1 = [ones(1,7500), zeros(1,5000),ones(1,2500),zeros(1,20001)]; | ||
+ | |||
% time for Note G | % time for Note G | ||
+ | |||
t2 = [zeros(1,7500), ones(1,2500),zeros(1,5000),ones(1,2500),zeros(1,17501)]; | t2 = [zeros(1,7500), ones(1,2500),zeros(1,5000),ones(1,2500),zeros(1,17501)]; | ||
+ | |||
% time for Note C | % time for Note C | ||
+ | |||
t3 = [zeros(1,10000),ones(1,2500),zeros(1,5000),ones(1,2500),zeros(1,15001)]; | t3 = [zeros(1,10000),ones(1,2500),zeros(1,5000),ones(1,2500),zeros(1,15001)]; | ||
+ | |||
% time for Note GL | % time for Note GL | ||
+ | |||
t4 = [zeros(1,20000),ones(1,2500),zeros(1,12501)]; | t4 = [zeros(1,20000),ones(1,2500),zeros(1,12501)]; | ||
+ | |||
% time for Note EL | % time for Note EL | ||
+ | |||
t5 = [zeros(1,22500),ones(1,2500),zeros(1,10001)]; | t5 = [zeros(1,22500),ones(1,2500),zeros(1,10001)]; | ||
+ | |||
% time for Note AL | % time for Note AL | ||
+ | |||
t6 = [zeros(1,25000),ones(1,2500),zeros(1,5000),ones(1,2501)]; | t6 = [zeros(1,25000),ones(1,2500),zeros(1,5000),ones(1,2501)]; | ||
+ | |||
% time for Note BL | % time for Note BL | ||
+ | |||
t7 = [zeros(1,27500),ones(1,2500),zeros(1,5001)]; | t7 = [zeros(1,27500),ones(1,2500),zeros(1,5001)]; | ||
+ | |||
% time for Note ALS | % time for Note ALS | ||
+ | |||
t8 = [zeros(1,30000),ones(1,2500),zeros(1,2501)]; | t8 = [zeros(1,30000),ones(1,2500),zeros(1,2501)]; | ||
%play the song | %play the song | ||
− | + | ||
+ | y = sin(2*pi*E*t).*t1 +... | ||
sin(2*pi*G*t).*t2 +... | sin(2*pi*G*t).*t2 +... | ||
sin(2*pi*C*t).*t3 +... | sin(2*pi*C*t).*t3 +... | ||
Line 42: | Line 66: | ||
sin(2*pi*ALS*t).*t8; | sin(2*pi*ALS*t).*t8; | ||
− | + | sound(y,1/del); |
Latest revision as of 01:40, 25 June 2009
% 5x/6 = 440
x = 440*6/5; % solve for x
E = 5*x /8; % Middle E
G = 3*x /4; % middle G
C = x; % middle C
GL = 3*x/8; % Lower G
EL = 5*x/16; % LOwer E
AL = 5*x/12; % lower A
BL = 15*x/36; % lower B
ALS = 233.08; % lower A#
del = 0.0001; % 12 notes , 2500 for each
t = 0:del:3.5; % total length 35001
% time for Note E
t1 = [ones(1,7500), zeros(1,5000),ones(1,2500),zeros(1,20001)];
% time for Note G
t2 = [zeros(1,7500), ones(1,2500),zeros(1,5000),ones(1,2500),zeros(1,17501)];
% time for Note C
t3 = [zeros(1,10000),ones(1,2500),zeros(1,5000),ones(1,2500),zeros(1,15001)];
% time for Note GL
t4 = [zeros(1,20000),ones(1,2500),zeros(1,12501)];
% time for Note EL
t5 = [zeros(1,22500),ones(1,2500),zeros(1,10001)];
% time for Note AL
t6 = [zeros(1,25000),ones(1,2500),zeros(1,5000),ones(1,2501)];
% time for Note BL
t7 = [zeros(1,27500),ones(1,2500),zeros(1,5001)];
% time for Note ALS
t8 = [zeros(1,30000),ones(1,2500),zeros(1,2501)];
%play the song
y = sin(2*pi*E*t).*t1 +...
sin(2*pi*G*t).*t2 +... sin(2*pi*C*t).*t3 +... sin(2*pi*GL*t).*t4 +... sin(2*pi*EL*t).*t5 +... sin(2*pi*AL*t).*t6 +... sin(2*pi*BL*t).*t7 +... sin(2*pi*ALS*t).*t8;
sound(y,1/del);