📄 findpitch.m
字号:
function PT=findpitch(s)
% compute the pitch of speech s
[B,A]=butter(5,700/4000);
% Butterworth digital and analog filter design and returns the filter coefficients
% in length N+1 vectors B (numerator) and A (denominator),cutoff frequency Wn must be 0.0 < Wn < 1.0,
%with 1.0 corresponding to half the sample rate.
s=filter(B,A,s);
R=zeros(143,1);
for k=1:143
R(k)=s(144:223)'*s(144-k:223-k);% the self-correlative coefficients
end
[R1,T1]=max(R(80:143));
T1=T1+79;
R1=R1/(norm(s(144-T1:233-T1))+1);
[R2,T2]=max(R(40:79));
T2=T2+39;
R2=R2/(norm(s(144-T2:233-T2))+1);
[R3,T3]=max(R(20:39));
T3=T3+19;
R3=R3/(norm(s(144-T3:233-T3))+1);
Top=T1;
Rop=R1;
if R2>=0.85*Rop
Rop=R2;
Top=T2;
end
if R3>0.85*Rop
Rop=R3;
Top=T3;
end
PT=Top;
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -