📄 genlfsrc.m
字号:
% genlfsrc.m
function [ps,dps]=genlfsrc(LF_ee,LF_tp,LF_te,LF_tc,LF_ta,pit_per)
% Generatevoicing source by LF model.
% pit_per=101;LF_tc=58;LF_tp=41;LF_te=55;LF_ta=4;LF_ee=60;
e0=0.0;ece=0.0;eps=0.0;alpha=0.0;wg=0.0;ps_1delay = 0.0;
tc = pit_per*LF_tc/100.0;% % instant of closure from begining
tp = pit_per*LF_tp/100.0;% % instant of +ve peak from begining
te = pit_per*LF_te/100.0;% % instant of -ve peak from begining
ta = pit_per*LF_ta/1000.0;% slope constant of return phase
ee = LF_ee; % desisred negative peak for excitation
ite = round(te);
itc = round(tc);
% timing parameters
[e0,alpha,wg,eps,ece]=lfsrc(tc, tp, te, ta, ee);
% generate the differentiated waveform
for j=0:pit_per-1,
if (j < ite) % opening phase
dug = e0*exp(alpha*(j+1))*sin(wg*(j+1));
elseif (j < itc & ta ~= 0.0) % closing phase
dug = -ee*(exp(-eps*((j+1)-ite))-ece)/(eps*ta);
% if the numerical analysis methods do not converge properly, then there
% may be cases when the area in the positive and the negative lobes of the
% differentiated waveform does not go to zero. If the return phase values in
% the differentiated waveform become positive then make them zero so that
% the return phase is to zero. But if the return phase does not reach
% zero value but remains negative then we cannot do anything about it.
if (dug > 0.0)
dug = 0.0;
end
else
dug = 0.0;
end
dps(j+1) = dug;
% integrate the differentiated waveform to get the glottal pulse.
ps(j+1) = dug + ps_1delay;
ps_1delay = ps(j+1);
if (j >= ite & ps(j+1) < 0.0)
ps(j+1) = 0.0;
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -