gchek.m

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

M
121
字号
% 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  %
%---------------------------------------------%

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

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

% get the display signal

clear signal gci0;

signal=speech;
gci0=gci;
ir0=ir;
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:',...
   'BackGroundColor',[0.68 0.68 0.68]);

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',fram_len);

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 :',...
   'BackGroundColor',[.68 .68 .68]);

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],'BackgroundColor',[.5 .5 .5],...
   'Callback','addgci');
%callback function [addgci.m]

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

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

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


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

Pcontour_f=figure('Unit','Normalized',...
   'Numbertitle','off',...
   'Color',[0.5 0.5 0.5],...
   'Position',[.32 .18 .67 .25 ], ...
   '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');
   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],'BackgroundColor','white',...
      'String','There is no GCI found.');
   
end

⌨️ 快捷键说明

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