nspuls.m

来自「这是一个用于语音信号处理的工具箱」· M 代码 · 共 66 行

M
66
字号
%FUNCTION: generate the excitation waveform by the noise component.
%          gpulse=nspulse(amp1,offset,amp2,duration,lens,aspgain,fgain) 
%          returns the noise component wavform.
%
% INPUT:   amp1,offset,amp2, duration = four timing parameter for  aspiration
%                                       noise
%          lens = the length of the pitch period
%          aspgain = gain for aspiration noise
%          fgain = gain for fricative noise
%
% OUTPUT:  
%       gpulse = an estimated differential glottal waveform
%
%                                        Author: Albert Hsiao 2/97

function gpulse=nspuls(amp1,offset,amp2,duration,lens,aspgain,fgain);

if nargin<6
    aspgain=0;
    fgain=0;
elseif nargin==6
    fgain=0;
end

% issue warning message
if (offset+duration)>1
   disp('Error in noise timing parameters!')
   disp('The sum of the offset and duration should be less than 1.');
   disp(['offset=' num2str(offset) ' duration=' num2str(duration) ]);
   return;
end

 
% 1. generate the aspration noise signal

 noise=10*( rand(1,lens)-0.5 );
 
 offset=fix(offset*lens);
 duration=fix(duration*lens);
 ns1=amp1*ones(1,offset);
 ns2=amp2*ones(1,duration);
 ns3=zeros(1,lens-offset-duration);

 noise=noise.*[ns1 ns2 ns3];
 gm= aspgain;
 if (amp1==0) & (amp2==0)
    amp=0;
 else
    amp=gm;
 end
 noise=amp*noise;


% 2. gererate the fricative noise signal

W=cshift(gauss(-1:2/lens:1,0,.25),floor(lens/2))+.5;
 fnoise=(rand(1,lens+1)-.5).*W;
 fnoise=fnoise(1:lens);
 amp=fgain;

 fnoise=amp*fnoise;

% 3. combine the two noise signals

 gpulse=noise+fnoise;

⌨️ 快捷键说明

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