function eval_blit3()
L = 64000;
Nb = 137;
Nphases = 256;
fs = 48000;
fstart = 110*4;
fend = 110*4;
df = (fend-fstart)/L;
fcut = 16000;

x = (0:Nb*Nphases-1) - (Nb*Nphases-1)/2;
H = sinc(2*fcut/fs.*x/Nphases);%.*kaiser(Nphases*Nb, 8)';
Hw = kaiser(Nb, 18)';

for ii=0:Nphases-1,
    for jj=0:Nb-1
        Hs(ii+1,jj+1) = H(Nphases-ii+Nphases*jj);
    end
end;


f = fstart;
Pic = 1;
blit(1:L) = zeros(1, L);
blit_bp(1:L) = zeros(1, L);
pol = 1;
for n = Nb:L,
	P = fs/f;
	Pi = floor(P);
	Pf = 1+fix(Nphases*(P - Pi));

	if Pic >= Pi,
		blit(n-Nb+1:n) = blit(n-Nb+1:n) + Hs(Pf,:).*Hw;
		blit_bp(n-Nb+1:n) = blit_bp(n-Nb+1:n) + pol*Hs(Pf,:).*Hw;
		Pic = 0;
		pol = -pol;
	end;
	Pic = Pic + 1;
	f = f + df;
end;

mean_blit = 0.0034;
mean_saw =  0.00;

saw(1:L) = zeros(1, L);
sqr(1:L) = zeros(1, L);
y_saw = 0;
y_sqr = 0;
for n = 2:L,
	y_saw = y_saw + blit(n)-mean_blit;
	y_sqr = y_sqr + blit_bp(n);
	saw(n) = -y_saw -1;
	sqr(n) = y_sqr;
end;

saw_nodc = filter([1 -1], [1 -0.995], saw);
sqr_nodc = filter([1 -1], [1 -0.995], sqr);

close all;
plot(saw); grid;

figure;
plot(saw_nodc); grid;

wavwrite(0.8*blit, fs, 'blit.wav');
wavwrite(0.7*saw_nodc, fs, 'saw.wav');
wavwrite(0.5*sqr_nodc, fs, 'sqr.wav');

