?? pitchacorr.m
字號(hào):
function [f0] = pitchacorr(len, fs, xseg)
% LPF at 900Hz
[bf0, af0] = butter(4, 900/(fs/2));
xseg = filter(bf0, af0, xseg);
% find the clipping level, CL
i13 = len/3;
maxi1 = max(abs(xseg(1:i13)));
i23 = 2 * len/3;
maxi2 = max(abs(xseg(i23:len)));
if maxi1>maxi2
CL=0.68*maxi2;
else
CL= 0.68*maxi1;
end
% Center clip waveform, and compute the autocorrelation
clip = zeros(len,1);
ind1 = find(xseg>=CL);
clip(ind1) = xseg(ind1) - CL;
ind2 = find(xseg <= -CL);
clip(ind2) = xseg(ind2)+CL;
engy = norm(clip,2)^2;
RR = xcorr(clip);
m = len;
% Find the max autocorrelation in the range 60 <= f <= 320 Hz
LF = floor(fs/320);
HF = floor(fs/60);
Rxx = abs(RR(m+LF:m+HF));
[rmax, imax] = max(Rxx);
imax = imax + LF;
f0 = fs/imax;
% Check max RR against V/UV threshold
silence = 0.4*engy;
if (rmax > silence) & (f0 > 60) & (f0 <= 320)
f0 = fs/imax;
else % -- its unvoiced segment ---------
f0 = 0;
end
[y, fs, nbits] = wavread('a17.wav'); %read in my speech file.
[P,F,I] = formant(y); %apply formant routine and
%return P, F, and I.
sound(y) %play the speech file.
plot(F,P) %plot formants.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -