% reseni pro zakladni ton ... LMIN = 20; LMAX = 160; % obycejna autokorelace ... ff = fopen ('test.l16','r'); s = fread (ff, [1 inf], 'short') / 32768.0; fclose (ff); SFR = frame (s, 240, 160); [dummy,Nfr] = size(SFR); lags = zeros(1,Nfr); for ii=1:Nfr, x = SFR(:,ii); L=pitchcor(x,LMIN,LMAX,0.5); lags (ii) = L; end subplot (311); plot(s); axis tight; subplot (312); plot(lags); axis tight; % NCCF - udelame na to funkciccku ... saux = [zeros(1,LMAX) s]; % pridani LMAX nul pred signal ... ptr = LMAX + 1; % pointer na 1. vzorek signalu. nccflags = zeros(1,Nfr); for ii=1:Nfr, [L,R] = nccf(saux,ptr,240,LMIN,LMAX,0.7); ptr = ptr + 80; % skaceme o frame-shift ... nccflags (ii) = L; end subplot (313); plot(nccflags); axis tight;