fchek.m

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

M
136
字号
% Function : Create a graphical user interface (GUI) to 
%           (1) display the automatically selected formant track
%           (2) check the track by zooming in and manual correct using the mouse.
%
% Fchek.m is a call_function executed by "c_pb_ft" on figure(c_win_f).
%

  %-------------------%
  % creat the fchek.f %
  %-------------------%

 Fchek_f=figure('Unit','Normalized',...
        'Numbertitle','off',...
        'Color',[0.5 0.5 0.5],...
        'Position',[.32 .5 .67 .425 ], ...
	'Name','Formant Tracks: Display and Manual Correction');

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

  %----------------------------------------------------%
  % provide zooming, shifting and correcting functions %
  %----------------------------------------------------%


shitf_text=uicontrol('Style','text',...
        'Units','normalized','Position',[0.01 .9 .11 .07],'String','Shift frames:',...
        'BackGroundColor',[.68 .68 .68]);

shift_lft=uicontrol('Style','Pushbutton',...
	'Unit','Normalized','Position',[.13 .9 .05 .07],'Visible','off','String','<',...
        'Callback','sf_LR=1;ftrkpl');
%callback function [ftrkpl.m]

shift_frms=uicontrol('Style','edit', ...
	'Unit','Normalized','Position',[.19 .9 .1 .07],'String','10');

shift_rght=uicontrol('Style','Pushbutton',...
	'Unit','Normalized','Position',[.30 .9 .05 .07],'Visible','off',...
        'String','>','Callback','sf_LR=-1;ftrkpl');
%callback function [ftrkpl.m]

zoom_text=uicontrol('Style','text',...
        'Units','normalized','Position',[.36 .9 .15 .07],'String','Zooming factor :',...
        'BackGroundColor',[.68 .68 .68]);

zm_zscale=uicontrol('Style','edit',...
        'Units','normalized','Position',[.52 .9 .05 .07],'String','2');

zm_in=uicontrol('Style','Pushbutton', ...
	'String','Zoom in','Units','normalized','Position',[.6 .9 .1 .07],'Callback', 'z_IO=1;ftrkpl');
%callback function [ftrkpl.m]

zm_out=uicontrol('Style','Pushbutton', ...
	'String','Zoom out','Units','normalized','Position',[.725 .9 .1 .07],'Callback', 'z_IO=-1;ftrkpl');
%callback function [ftrkpl.m]

return_pb=uicontrol('Style','Pushbutton',...
        'Units','normalized','Position',[.86 .9 .1 .07],...
        'Callback','close(Fcontour_f);close(Fchek_f);clear Rite Left FF0 FB0 signal nframnow vctyp0;',...
        'String','Return');


cor_pb=uicontrol('Style','Pushbutton', ...
	'String','Select formant to correct' ,...
        'Units','normalized','Position',[.05 .76 .25 .07],'BackgroundColor',[.5 .5 .5],...
        'Callback','Fdefault=0;fmcor');
%callback function [fmcor.m]

shift_up=uicontrol('Style','Pushbutton',...
	'Unit','Normalized','Position',[.32 .76 .04 .07],'Visible','off','String','+',...
        'Callback','sh_UP=1;sh_fmt');
%callback function [sh_fmt.m]

shift_dw=uicontrol('Style','Pushbutton',...
	'Unit','Normalized','Position',[.38 .76 .04 .07],'Visible','off','String','-',...
        'Callback','sh_UP=-1;sh_fmt');
%callback function [sh_fmt.m]

undo_pb=uicontrol('Style','Pushbutton', ...
	'String','Undo' ,'Visible','off',...
        'Units','normalized','Position',[.5 .76 .15 .07],'BackgroundColor',[.5 .5 .5],...
        'Callback','Fdefault=1;fmcor');
%callback function [fmcor.m]

apply_pb=uicontrol('Style','Pushbutton', ...
	'String','Apply the Correction' ,...
        'Units','normalized','Position',[.70 .76 .2 .07],'BackgroundColor',[.5 .5 .5],...
        'Visible','off',...
        'Callback','fmapp');
%callback function [fmapp.m]

  %---------------------------------------------------------%
  % plot the formant track on Fchek_f for manual correction %
  %---------------------------------------------------------%

% get the display signal

clear signal FF0 FB0 vctyp0;

signal=speech;
FF0=FF;
FB0=FB;
vctyp0=vctyp;
[nframe,dum]=size(FF0); % the number of frames

% initial setting
Left=1;
Rite=nframe;

% plot the formant track
sf_LR=0;
z_IO=0;
ftrkpl;

  %--------------------------------------%
  % plot the formant track on Fcontour_f %
  %--------------------------------------%

Fcontour_f=figure('Unit','Normalized',...
        'Numbertitle','off',...
        'Position',[.32 .10 .67 .35 ], ...
        'Color',[.5 .5 .5],...
	'Name','Formant Contour (reference)');
whitebg(Fcontour_f,'w');

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

plot(FF0,'k');hold on
% double plot on the voiced formant
frm=find(vctyp0>0);

plot([frm' frm' frm' frm' frm'],FF0(frm,:),'o');
hold off; 
title('Formant Track ( ''o'' represents voiced )');

⌨️ 快捷键说明

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