1 简介
语音信号作为一种非平稳信号,其形成和感知的过程是一个复杂信号的处理过程,本质上来说,就是模式匹配的过程。语音识别的性能主要受到2个方面的影响:一个是由环境噪声在前端随语音信号输入而产生的影响;另一个是建立的模型与语音实际的特征统计特性有差异而产生的影响。该系统识别过程包括预处理、特征提取、语音训练和语音识别4个部分,框图如图1所示。在预处理阶段对输入的语音信号进行滤波降噪、预加重、端点检测、分帧处理;在特征提取阶段对信号进行频域分析,所得参数作为语音模板,存储记录以完成语音训练;在语音识别阶段,提取输入语音信号的特征,与存储的语音模板比较,通过 DTW 算法进行匹配,最后根据识别决策输出相应的识别结果。
1.1 预滤波降噪
人耳对不同频率的感受不同,人耳的听觉频率范围通常在20Hz~20kHz,但人类的语音频率通常因此,对于混叠在语音信号中的噪声,可以设计带通滤波器,将低于300Hz高于4kHz的频率事先滤除。
1.2 预加重处理
在发声过程中,人类话音的高频部分往往被弱化,因此需要设计一个高通滤波器,来补偿语音信号受发声系统所压抑的高频部分,使信号的频谱变得平坦。通过传递函数为 H(z)=1-αz-1 的滤波器对其滤波,其中α为预加重系数,α∈ [0.9,1]。通过该系统完成对语音信号高频部分的加重,实现对高频分量的提升。
1.3 分帧
对预加重完成的语音进行分帧操作,提取短时特性。设定帧长为30ms,为避免相邻帧的变化过大,在相邻2帧之间设计一段重叠区域。设定帧移为20ms,然后将每帧信号与窗函数相乘,用于减少起始和结束处信号的不连续性。
1.4 端点检测
一段完整的语音信号,可以分为:静音、语音、词汇停顿、语音、静音几个阶段。端点检测的作用是区分语音部分和非语音部分,将语音信号中存在语音的部分标记出,方便后续特征参数提取。端点检测一般计算每一帧语音信号的过零率和能量,只有当该帧信号的过零率和能量同时超过设定门限时,才认定该帧具有有效的语音输入。而一段语音信号通常还会掺杂环境噪声,其干扰将对特征参数的提取造成直接影响。孤立词端点检测不准确,通常有内外2个原因。外部原因在于噪声干扰,内部原因在于发音特点。由于语音输入环境多变,噪声的干扰又分为突发噪声干扰与持续噪声干扰。针对突发噪声,部分突发噪声也具有能量高,过零率高的特点,但通常其持续时间较短。当某一帧语音信号具有高能量、高过零率时,考察其持续时间,若持续时间低于人类单个语音表述的长度,则判定为环境突发噪声,继续对该帧信号以后的语音进行分析,否则判定为语音输入,标记端点。
2 部分代码
function [x,mn,mx]=melbankm(p,n,fs,fl,fh,w)
%MELBANKM determine matrix for a mel-spaced filterbank [X,MN,MX]=(P,N,FS,FL,FH,W)
%
% Inputs:p number of filters in filterbank
%n length of fft
%fs sample rate in Hz
%fl low end of the lowest filter as a fraction of fs (default = 0)
%fh high end of highest filter as a fraction of fs (default = 0.5)
%w any sensible combination of the following:
% 't' triangular shaped filters in mel domain (default)
% 'n' hanning shaped filters in mel domain
% 'm' hamming shaped filters in mel domain
%
% 'z' highest and lowest filters taper down to zero (default)
% 'y' lowest filter remains at 1 down to 0 frequency and
% highest filter remains at 1 up to nyquist freqency
%
% If 'ty' or 'ny' is specified, the total power in the fft is preserved.
%
% Outputs:x a sparse matrix containing the filterbank amplitudes
% If x is the only output argument then size(x)=[p,1+floor(n/2)]
% otherwise size(x)=[p,mx-mn+1]
%mn the lowest fft bin with a non-zero coefficient
%mx the highest fft bin with a non-zero coefficient
%
% Usage:f=fft(s);f=fft(s);
%x=melbankm(p,n,fs);[x,na,nb]=melbankm(p,n,fs);
%n2=1+floor(n/2);z=log(x*(f(na:nb)).*conj(f(na:nb)));
%z=log(x*abs(f(1:n2)).^2);
%c=dct(z); c(1)=[];
%
% To plot filterbanks e.g.plot(melbankm(20,256,8000)')
%
% Copyright (C) Mike Brookes 1997
% Version: $Id: melbankm.m,v 1.3 2005/02/21 15:22:13 dmb Exp $
%
% VOICEBOX is a MATLAB toolbox for speech processing.
% Home page: http://www.ee.ic.ac.uk/hp/staff/dmb/voicebox/voicebox.html
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You can obtain a copy of the GNU General Public License from
% ftp://prep.ai.mit.edu/pub/gnu/COPYING-2.0 or by writing to
% Free Software Foundation, Inc.,675 Mass Ave, Cambridge, MA 02139, USA.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if nargin < 6
w='tz';
if nargin < 5
fh=0.5;
if nargin < 4
fl=0;
end
end
end
f0=700/fs;
fn2=floor(n/2);
lr=log((f0+fh)/(f0+fl))/(p+1);
% convert to fft bin numbers with 0 for DC term
bl=n*((f0+fl)*exp([0 1 p p+1]*lr)-f0);
b2=ceil(bl(2));
b3=floor(bl(3));
if any(w=='y')
pf=log((f0+(b2:b3)/n)/(f0+fl))/lr;
fp=floor(pf);
r=[ones(1,b2) fp fp+1 p*ones(1,fn2-b3)];
c=[1:b3+1 b2+1:fn2+1];
v=2*[0.5 ones(1,b2-1) 1-pf+fp pf-fp ones(1,fn2-b3-1) 0.5];
mn=1;
mx=fn2+1;
else
b1=floor(bl(1))+1;
b4=min(fn2,ceil(bl(4)))-1;
pf=log((f0+(b1:b4)/n)/(f0+fl))/lr;
fp=floor(pf);
pm=pf-fp;
k2=b2-b1+1;
k3=b3-b1+1;
k4=b4-b1+1;
r=[fp(k2:k4) 1+fp(1:k3)];
c=[k2:k4 1:k3];
v=2*[1-pm(k2:k4) pm(1:k3)];
mn=b1+1;
mx=b4+1;
end
if any(w=='n')
v=1-cos(v*pi/2);
elseif any(w=='m')
v=1-0.92/1.08*cos(v*pi/2);
end
if nargout > 1
x=sparse(r,c,v);
else
x=sparse(r,c+mn-1,v,p,1+fn2);
end
3 仿真结果
4 参考文献
[1]李法强. 基于小波变换的语音识别的研究和应用[D]. 桂林理工大学, 2011.