gchek.m

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

M
123
字号
% Function : Create a graphical user interface (GUI) to 
%           (1) display the automatically selected glottal closure indices (GCI)
%           (2) check the GCIs by zooming in and manual correction using the mouse.
%
% Gchek.m is a call_function executed by "c_pb_gci" on figure(c_win_f).
%

%---------------------------------------------%
% plot the GUIs along with the speech signal  %
%---------------------------------------------%

disp(' ');
disp('SCRIPT:   gchek.m ***********************************');


Gchek_f=figure('Unit','Normalized',...
   'Numbertitle','off',...
   'Color',BACK_COLOR,...
   'Position',[.32 .45 .67 .45 ], ...
   'Resize','on',...
   'Name','GCI Display and Manual Correction');

axes('Position',[.06 .135 .9 .6],'Box','on','Visible','off');
whitebg(Gchek_f,'w');


%  signal is the speech data
gci0=gci;  %this is the gci to be modified if desired
gci_safe=gci;  %save the original gci
ir0=ir_save; %saved from pkpk_1b.m; used in addgci.m
lens=length(signal); % the length of the signal
% initial setting
left=1;
right=lens;

% plot the speech signal with circled gci0
% find GCIs between the margins
idx=find(gci0>=left & gci0<=right);
plot((left:right),signal(left:right),'b',gci0(idx),signal(gci0(idx)),'ko');
axis([gci0(1) max(gci0) min(signal) max(signal) ]);

% provide the zooming and shifting functions

shitf_text=uicontrol('Style','text',...
   'Units','normalized','Position',[0.01 .875 .10 .08],'String','Shift pts:');

shift_left=uicontrol('Style','Pushbutton',...
   'Unit','Normalized','Position',[.12 .875 .05 .08],'Visible','off','String','<',...
   'Callback','sf_flag=1;shft');
%callback function [shft.m]

shift_pts=uicontrol('Style','edit', ...
   'Unit','Normalized','Position',[.18 .875 .1 .08],'String',250);

shift_right=uicontrol('Style','Pushbutton',...
   'Unit','Normalized','Position',[.29 .875 .05 .08],'Visible','off',...
   'String','>','Callback','sf_flag=-1;shft');
%callback function [shft.m]

zoom_text=uicontrol('Style','text',...
   'Units','normalized','Position',[.38 .875 .20 .08],'String','Zooming factor :');

zoom_zscale=uicontrol('Style','edit',...
   'Units','normalized','Position',[.59 .875 .05 .08],'String','2');

zoom_in=uicontrol('Style','Pushbutton', ...
   'String','Zoom in','Units','normalized','Position',[.69 .875 .13 .08],'Callback', 'Zio=1;zoomio');
%callback function [zoomio.m]

zoom_out=uicontrol('Style','Pushbutton', ...
   'String','Zoom out','Units','normalized','Position',[.84 .875 .13 .08],'Callback', 'Zio=-1;zoomio');
%callback function [zoomio.m]

add_pb=uicontrol('Style','Pushbutton', ...
   'String','Add one gci' ,...
   'Units','normalized','Position',[.15 .76 .2 .08],...
   'Callback','addgci');
%callback function [addgci.m]

delet_pb=uicontrol('Style','Pushbutton', ...
   'String','Delete one gci' ,...
   'Units','normalized','Position',[.4 .76 .2 .08],...
   'Callback','delgci');
%callback function [delgci.m]

app_pb=uicontrol('Style','Pushbutton', ...
   'String','Apply' ,...
   'Units','normalized','Position',[.65 .76 .13 .08],...
   'Visible','off',...
   'Callback','gci_ed');

return_pb=uicontrol('Style','Pushbutton',...
   'String','Return' ,...
	'Units','normalized','Position',[.84 .76 .13 .08],...
   'Callback','close(Pcontour_f);close(Gchek_f);clear right left right_r left_r signal lens ir0 lethnow');


%------------------------%
% plot the pitch contour %
%------------------------%

Pcontour_f=figure('Unit','Normalized',...
   'Numbertitle','off',...
   'Color',BACK_COLOR,...
   'Position',[.32 .18 .67 .25 ], ...
   'Resize','on',...
   'Name','Pitch Contour (reference)');

axes('Position',[.06 .1 .9 .78],'Box','on','Visible','off');
whitebg(Pcontour_f,'w');

if ~isempty(gci0)
   plot(gci0(1:length(gci0)-1),diff(gci0),'b','color','blue');
   title('Pitch periods at the glottal closure indices');
   axis([gci0(1) max(gci0) 0.35*mean(diff(gci0)) 2*mean(diff(gci0)) ]);
else
   txt=uicontrol('Style','text',... 
      'Units','normalized','Position',[0.1 .475 .8 .1],...
      'String','There is no GCI found.');
   
end

⌨️ 快捷键说明

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