function eval_blit()

sinc_use_lut = 1

L = 40000;
fs = 48000;
fstart = 110;
fend = 1100;
df = (fend-fstart)/L;

nhw = 4096;
Hw = kaiser(nhw, 8)';

if sinc_use_lut == 1
    
    nharm = 512;
    nsin = 4096;
    xx = (0:nsin)/nsin - 0.5;
    mmm=0;
    for mm=1:nharm,
        mmm=mmm+1;
        bb(mm, :) = sin(mmm*xx*pi);
    end;
    aa = sin(xx*pi);
end;

sinc_m(mm, find(aa == 0)) = 1;

x = 0.5;
z = -1;
f = fstart;
sqr = 0.0;
c4 = 0;
a = 1;
b = 1;
for n = 1:L,

	if x >= 0.5,
		x = x - 1;
		p = fs/f;
		fraq  = 1.0/p;
		m = fix((p/2.0)) + 1;
		saw = 0.0;
		c3 = 0.0;
		z = -z;
	end;
    if sinc_use_lut == 1
        nn = (x+0.5)*nsin + 1;
        ni = fix(nn);
        nf = nn - ni;
        bbi = (bb(m, ni+1) - bb(m, ni))*nf + bb(m, ni);     % Fractional delay (linear interpolation)
        aai = (aa(ni+1) - aa(ni))*nf + aa(ni);              % Fractional delay (linear interpolation)
        if (aai ~= 0)
            blit = fraq* bbi / aai  * Hw(fix((x+0.5)*nhw)+1);
        else
            blit = fraq;
        end
    else
        b = sin(m*x*pi);
        a = sin(x*pi);
        if (a ~= 0)
            blit = fraq * b/a * Hw(fix((x+0.5)*nhw)+1);
        else
            blit = fraq;
        end
    end
    
	saw = saw + blit;
	sqr = sqr + z*blit;
	vsaw(n) = 2*(saw - c3);
	vsqr(n) = 2*(sqr - 0.5);
	vblit(n) = blit;
    vc3(n) = b;
	x = x + fraq;
	c3 = c3 + fraq;
	f = f + df;
    c4 = c4 + fraq - blit;
    vc4(n) = a;
end;
		

close all

figure;
plot(1:L, vsaw, 1:L, vc4, 1:L, vblit); grid;

figure;
plot(vc4); grid;

figure;
plot(vc3); grid;

if sinc_use_lut == 1
    figure;
    plot(sinc_m(nharm, :)); grid;
end;

wavwrite(0.5*vc4, fs, 'c4.wav');
wavwrite(0.5*vc3, fs, 'c3.wav');
wavwrite(0.5*vsqr, fs, 'sqr.wav');
wavwrite(0.5*vsaw, fs, 'saw.wav');
wavwrite(0.5*vblit, fs, 'blit.wav');

