addgci.m

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

M
46
字号
% Function : add a gci to the GCI display using the mouse.
%    Addgci will add one gci in the neighborhood of the mouse pointing position.
%
%    Addgci.m is a call_function executed by "add_pb" for figure(m_gci_f).

% 1. secify the neighborhood of the pointing mouse 
[xgci y]=ginput(1);

% 2. find the minimum value of ir in the neighborhood
xgci=ceil(xgci);
if (xgci-15<=0)
  [aa,bb]=min( ir0(1:xgci+15) );
elseif ((xgci+15)>length(ir0))
  [aa,bb]=min( ir0(xgci-15:length(ir0)) );
else
  [aa,bb]=min( ir0(xgci-15:xgci+15) );
end
bb=floor(xgci-15+bb-1);

% 3. insert the gci into original gci sequence
iidx=find( gci0<=(bb-1) );
iidx=max(iidx);

if isempty(iidx)  % add GCI at the beginning
   iidx=0;
end

lengci=length(gci0);

gci0(iidx+1:lengci+1)=[bb gci0(iidx+1:lengci)];

% 4. plot the signal with gci0
idx=find(gci0>=left & gci0<=right);

figure(Gchek_f);
plot((left:right),signal(left:right),'b',gci0(idx),signal(gci0(idx)),'ko',...
     bb,signal(bb),'b+');

figure(Pcontour_f);
plot(gci0(1:length(gci0)-1),diff(gci0),'b');
title('Pitch periods at the glottal closure indexes');
axis([gci0(1)-100 max(gci0) 0.35*mean(diff(gci0)) 2*mean(diff(gci0)) ]);

set(app_pb,'Visible','on');
clear xgci y aa bb iidx lengci;

⌨️ 快捷键说明

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