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

📄 gen_dgf1.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
% Function : generate a glottal impulse from the polynomial model.
function gpulse=gen_dgf1(cof,lenss,noise)
% Input :
%	cof = polynomial coefficients for the current excitation pulse.
%	lenss = length of the pitch period of the underlying glottal impulse.
%	noise = adding noise if 'noise ~= 0.'
% Output :
%	gpulse = results of the glottal impulse.
% See Also: polym1.

if nargin==2
   noise=0;
end

% generate the polynomial glottal waveform.
xx=0:1/lenss:1;

% recovering from step (5)
gpulse=polyval(cof,xx);

% recovering from step (4) -weighting function
 
for i=1:lenss+1
     x=xx(i);
     if x<0.1
        weit(i)=200*x*x-40*x+3;
     elseif x<0.8
        weit(i)=1;
     else
        weit(i)=25*x*x-40*x+17;
     end
end

gpulse=gpulse./weit;

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

% create a pulse swing
maxg=max(gpulse(1:floor(lenss/5)));
gpulse(3)=(maxg+1)*.42-1;
gpulse(4)=.5*gpulse(3)+.5*gpulse(4);

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

%--------------------------------------------------------------------------

% Add modulated noise.
if noise
	W=cshift(gauss(-1:2/lenss:1,0,.25),floor(lenss/2))+.5;
	nn=(rand(1,lenss+1)-.5).*W;
	amp=sqrt(0.032*gpulse*gpulse'/(nn*nn'));
	gpulse=gpulse+nn*amp;
end;

%remove the DC term
gpulse=gpulse-mean(gpulse);
gpulse=gpulse(1:lenss);

⌨️ 快捷键说明

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