% Definisi Tempo
Fs = 16000; %Frekuensi Sampling
t1 = 0:1/Fs:0.5;
t25 = 0:1/Fs:0.125;
t75 = 0:1/Fs:0.375;
t05 = 0:1/Fs:0.25;
t15 = 0:1/Fs:0.75;
t175 = 0:1/Fs:0.875;
t2 = 0:1/Fs:1;
t3 = 0:1/Fs:1.5;

% Definisi Frekuensi not
c  = sin(2*pi*261.6*t1);
c05  = sin(2*pi*261.6*t05);
c15 = sin(2*pi*261.6*t15);
c2  = sin(2*pi*261.6*t2);
c3  = sin(2*pi*261.6*t3);
C05   = sin(2*pi*523.3*t05);
C75   = sin(2*pi*523.3*t75);
C   = sin(2*pi*523.3*t1);
C15   = sin(2*pi*523.3*t15);
C2   = sin(2*pi*523.3*t2);
C3   = sin(2*pi*523.3*t3);
d05 = sin(2*pi*293.7*t05);
D05 = sin(2*pi*587.3*t05);
D25 = sin(2*pi*587.3*t25);
D75 = sin(2*pi*587.3*t75);
D2 = sin(2*pi*587.3*t2);
D15 = sin(2*pi*587.3*t15);
D3 = sin(2*pi*587.3*t3);
D = sin(2*pi*587.3*t1);
d = sin(2*pi*293.7*t1);
d15 = sin(2*pi*293.7*t15);
d2 = sin(2*pi*293.7*t2);
d25 = sin(2*pi*293.7*t25);
e   = sin(2*pi*329.6*t1);
e75   = sin(2*pi*329.6*t75);
e05 = sin(2*pi*329.6*t05);
e15 = sin(2*pi*329.6*t15);
e2  = sin(2*pi*329.6*t2);
e3  = sin(2*pi*329.6*t3);
E05 = sin(2*pi*659.3*t05);
E = sin(2*pi*659.3*t1);
E25 = sin(2*pi*659.3*t25);
E15 = sin(2*pi*659.3*t15);
E3 = sin(2*pi*659.3*t3);
E75 = sin(2*pi*659.3*t75);
E2 = sin(2*pi*659.3*t2);
f   = sin(2*pi*349.2*t1);
Fk   = sin(2*pi*740*t1);
f05   = sin(2*pi*349.2*t05);
f15   = sin(2*pi*349.2*t15);
f2   = sin(2*pi*349.2*t2);
f25   = sin(2*pi*349.2*t25);
f3   = sin(2*pi*349.2*t3);
F   = sin(2*pi*698.5*t1);
F05   = sin(2*pi*698.5*t05);
F15   = sin(2*pi*698.5*t15);
F75   = sin(2*pi*698.5*t75);
F175   = sin(2*pi*698.5*t75);
F2   = sin(2*pi*698.5*t2);
F3   = sin(2*pi*698.5*t3);
g   = sin(2*pi*392.0*t1);
G2   = sin(2*pi*784.0*t2);
G   = sin(2*pi*784.0*t1);
g05   = sin(2*pi*392.0*t05);
g15   = sin(2*pi*392.0*t15);
g2   = sin(2*pi*392.0*t2);
g3   = sin(2*pi*392.0*t3);
a15 = sin(2*pi*440*t15);
a   = sin(2*pi*440*t1);
a05   = sin(2*pi*440*t05);
a2   = sin(2*pi*440*t2);
a3   = sin(2*pi*440*t3);
b   = sin(2*pi*493.9*t1);
b05   = sin(2*pi*493.9*t05);
b25   = sin(2*pi*493.9*t25);
b2   = sin(2*pi*493.9*t2);
b3   = sin(2*pi*493.9*t3);
nol = [zeros(size(t1))];

% Nada
nada1=[g,e75,d25,g,C75,D25,E2,C2,C15,b05,D05,C05,b05,a05,g3,nol];
nada2=[g,e75,f25,g,C75,D25,E2,C2,D15,D05,E,Fk,G2,nol];
nada3=[D,D75,D25,E,E,F15,E05,F2,E,E75,D25,C,E,D3,nol];
nada4=[g,C75,D25,E,G,G2,F,E75,D25,C2,D2,E3,nol];
nada5=[g,C75,D25,E,G,G2,F,E75,D25,E2,D2,C3,nol];

% Lagu
lagu=[nada1,nada2,nada3,nada4,nada5];

sound(lagu,Fs)
wavwrite(lagu,'bangunpp.wav')