% 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);