语音是由气流激励声道从嘴唇或鼻孔辐射出来而产生的。根据声带是否振动,发音可分为浊音和清音。浊音和清音有明显的区别,浊音具有周期信号的特征,而清音则具有随机噪声的特征;浊音在频域上具有共振峰结构,其能量主要集中在低频带,清音的振幅值相对较小,在时域和频域没有明显的规律性。清音和浊音的正确判断在语音识别、语音合成、语音编码中具有重要作用。传统的清浊音区分方法有:短时能量法、短时自相关函数法和过零点法等。由于实际语音常有连读以及单音素发音过短的情况,现有的清浊音判断方法也会出现判断不准确的情况。
程序运行环境为MATLAB R2021B,为基于瞬时频率的语言信号清/浊音判决和高音检测,部分代码如下:
Matlab
%% Comparison with Matlab'2020 built-infunction (pitch) (Method: SRH (Drugman 2011)%%%%
[f0_matlab_value,idx] = pitch(s,fs, ...
'Method','SRH', ...
'WindowLength',framedur*fs/1000, ...
'OverlapLength',timestep*fs/1000, ...
'Range',[f0min,f0max], ...
'MedianFilterLength',smoothing_dur*fs/1000);
hr = harmonicRatio(s,fs,"Window",hamming(framedur*fs/1000,'periodic'),...
"OverlapLength",timestep*fs/1000);
hr_threshold=0.4;
f0_matlab_value(hr<hr_threshold)=0;
%完整代码:mbd.pub/o/bread/mbd-ZZ6blJtu
%%%%%%%% Draw extracted f0 %%%%%%%%%%%%%%%%%%
subplot(3,1,3)
f0_matlab_time = 1000*(idx - 1)/fs;
vuv_matlab=(hr<hr_threshold);
plot(f0_matlab_time,f0_matlab_value)
hold on
plot(f0_ref_time,f0_ref_value)
xlabel('Time (s)')
ylabel('Pitch (Hz)')
legend('F0 est by Matlab','Gnd truth f0')
title('F0 contour extracted from Matlab built-in function (pitch)')