⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lfpuls.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
%FUNCTION: generate the glottal pulse by the LF model.
%          gpulse=lfpuls(Tp,Te,Ta,Tc,Ee,lens) returns the extimated
%          glottal wavform.
%
% INPUT:   Tp,Te,Ta,Tc = four timing parameter for LF model
%          Ee = max negative differential waveform value
%          lens = the length of the pitch period
%
% OUTPUT:  
%       gpulse = an estimated differential glottal waveform
%
%                                        Author: Albert Hsiao 2/97

function gpulse=lfpuls(Tp,Te,Ta,Tc,Ee,lens);


% issue warning message
if Te>Tc
   disp('Error in LF timing parameters; Te should be less than Tc');
   disp(['Te=' num2str(Te) ' Tc=' num2str(Tc) ]);
   Tc=1;
   return;
end

if Tp>Tc
   disp('Error in LF timing parameters; Tp should be less than Tc');
   disp(['Tp=' num2str(Tp) ' Tc=' numstr(Tc) ]);
   return;
end

if Tp>Te
   disp('Error in LF timing parameters; Tp should be less then Te');
   disp(['Tp=' num2str(Tp) ' Te=' num2str(Te)]);
   return;
end  

 
% 1. estimate the LF computing parameters
  T0=lens;
  Tp=Tp*T0;
  Te=floor(Te*T0);
  Ta=Ta*T0;
  Tc=floor(Tc*T0);

 [alpha,eps1,ece,wg,e0,OK]=lfsrc(Tp,Te,Ta,Tc,Ee);
 if OK==0
     return;
 end

% 2. gererate the LF pulse

 gp=zeros(1,lens);
 for i=1:Te
     gp(i)=e0*exp(alpha*i)*sin(wg*i);
 end

 for i=Te:Tc
     tmp_gp=-Ee*exp((-eps1*(i-Te)-ece))/(eps1*Ta);
     if tmp_gp<0.0
        gp(i)=tmp_gp;
     else
        gp(i)=0;
     end
 end 

 gpulse=gp;

 % 3. produce high-energy pulse at the glottal closure (follow Dr.Hu's approach)

 option=0;
 if option==1
   
   gpulse0=gpulse;

   % create a pulse swing
   gpulse(1)=gpulse(lens);
   gpulse(3)=0.6*gpulse(2)+0.4*gpulse(1);
   gpulse(6)=0.5*gpulse(6)+0.5*gpulse(3);
   gpulse=gpulse-mean(gpulse);

   % Remove the spectral tilt of the excitation pulse by inverse filtering
   ss=gpulse(2:lens);
   ss=ss(:);
   energy=ss'*ss;
   rc1=ss(1:lens-2)'*ss(2:lens-1)/energy; % first order reflect coefficient
   gpulse=filter([1 -.75*rc1],1,gpulse);  % first-order inverse filtering
   gpulse(1)=gpulse(lens);

   gpulse=0.3*gpulse+0.7*gpulse0;

 end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -