使用自相关方法进行音高估计

信息处理 matlab 自相关 沥青 演讲 基频
2022-02-06 03:29:57

我有以下代码:

// input: speech segment
[y,Fs,bits]= wavread('/media/A03036C33036A068/scilab/30msec_voiced.wav');
max_value=max(abs(y));
y=y/max_value;
t=(1/Fs:1/Fs:(length(y)/Fs))*1000;
subplot(2,1,1);
plot(t,y);
xtitle('A 30 millisecond segment of speech','time in milliseconds');
sum1=0;autocorrelation=0;
for l=0:(length(y)-1)
    sum1=0;
    for u=1:(length(y)-l)
        s=y(u)*y(u+l);
        sum1=sum1+s;
    end
    autocor(l+1)=sum1;
end
kk=(1/Fs:1/Fs:(length(autocor)/Fs))*1000;
subplot(2,1,2);
plot(kk,autocor);
xtitle('Autocorrelation of the 30 millisecond segment of speech','time in milliseconds');
auto=autocor(21:160);
max1=0;
for uu=1:140
    if(auto(uu)>max1)
        max1=auto(uu);
        sample_no=uu;
    end
end
pitch_period_To=(20+sample_no)*(1/Fs)
pitch_freq_Fo=1/pitch_period_To

在这方面,我没有理解pitch_period_To=(20+sample_no)*(1/Fs). 他们为什么要加 20 个?

1个回答

20 个样本的偏移量添加为 ( ) 上方的 8 行,auto=autocor(21:160)此偏移量从自相关序列中删除。因此,在您提到的那一行中,必须考虑此偏移量。

这样做是为了消除第一个最大值(在时间滞后于零附近)并避免由于选择对基频估计任务没有意义的延迟值而导致的音高误差。

(顺便说一句,您的代码不执行音高估计,而是执行基频估计。这两个术语之间存在差异,因为音高与音调的感知属性有关,而基频是技术属性 -维基百科上的“音高”。)