sset.m

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

M
141
字号
% Script : Create a graphical user interface (GUI) to 
%           (1) display the formant tracks of the speech signal
%           (2) modify the formant track according to user design.
%
% Sset.m is a call_function executed by "m_pb_sg" on figure(m_win_f).
%

  %------------------------------------------------------%
  %  create the Sdis_f for displaying the formant track  %
  %------------------------------------------------------%

 
  % the formant track modification is available only for the formant configuration
  if vt==1

    Sdis_f=figure('Units','Normalized',...
        'Numbertitle','off',...
        'Position',[.165 .5 .3 .2 ],...
        'Color','white',...
	'Name','Formant Track Display');

        text=uicontrol('Style','text',...
          'Units','normalized',...
          'Position',[0.1 0.61 0.8 0.15],...
          'BackGroundColor','white',...
	  'String','Sorry, this function is not available');

        text=uicontrol('Style','text',...
          'Units','normalized',...
          'Position',[0.1 0.5 0.8 0.15],...
          'BackGroundColor','white',...
	  'String','for LP configuration .');

        return_pb=uicontrol('Style','Pushbutton',...
          'Units','normalized','Position',[.2 .3 .6 .2],...
          'Callback','close(Sdis_f);',...
          'String','Return');

     return;
  end

   Sdis_f=figure('Units','Normalized',...
        'Numbertitle','off',...
        'Position',[.315 .2 .68 .7 ],...
        'Color',[.5 .5 .5],...
	'Name','Formant Track Display');

   whitebg(Sdis_f,'w');

   if exist('vctyp3') 
      vctyp1=vctyp3;
   else
      vctyp1=vctyp;
   end
   frm=find(vctyp1>0);  % voiced frame

   if exist('FF3') 
      FF1=FF3;
      FB1=FB3;
   else
      FF1=FF;
      FB1=FB;
   end

   % calculate the average formant frequency
   avFF1=mean(FF1(frm,:));

   % plot the pitch contour on Smod.f 

   plot(FF1,'k'); hold on;% double plot on the voiced formant
     plot([frm' frm' frm' frm' frm'],FF1(frm,:),'+');
   hold off; 
   axis([1 nframe 0 5000])
   title('Formant Track ( ''+'' represents voiced )');
   xlabel('Time');
   ylabel('Frequency (Hz)');

  %--------------------------------------------%
  %  create the Sset_f Graphic User Interface  %
  %--------------------------------------------%

  Sset_f=figure('Units','Normalized',...
        'Numbertitle','off',...
        'Position',[.165 .2 .15 .6 ],...
        'Color','white',...
	'Name','Spectrogram Mod.');


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

select_text=uicontrol('Style','text',...
        'Units','normalized','Position',[0.05 .91 .9 .06],'String','select formant:',...
        'BackGroundColor','white');

formant_pp=uicontrol('Style','Popup', ...
      'String','1st formant|2nd formant|3rd formant|4th formant|5th formant',...
      'Units','normalized','Position',[.05 .83 .9 .08],'Callback', 'spset;');
%callback function [spset.m]

target_text=uicontrol('Style','text',...
        'Units','normalized','Position',[0.05 .73 .9 .06],'String','original ave. freq.:',...
        'BackGroundColor','white');

fmnt1_text=uicontrol('Style','text',...
        'Units','normalized','Position',[0.05 .67 .9 .06],'String',num2str(avFF1(1)) );

source_text=uicontrol('Style','text',...
        'Units','normalized','Position',[0.05 .56 .9 .06],'String','modified ave. freq.:',...
        'BackGroundColor','white');

formant_edit=uicontrol('Style','Edit', ...
	'String',num2str(avFF1(1)),'Units','normalized','Position',[.05 .50 .9 .06],...
        'Callback','Up=2;spchg;');
%callback function [spchg.m]

fmt_slider=uicontrol('Style','Slider', ...
        'Units','Normalized','Position',[.05 .42 .9 .06],...
        'Value',avFF1(1),'Min',200,'Max',4700,...
	'Callback', 'Up=1;spchg;');
%callback function [spchg.m]

undo_pb=uicontrol('Style','Pushbutton', ...
	'String','Undo' ,'Visible','on',...
        'Units','normalized','Position',[.15 .24 .7 .08],...
        'Callback','App=0;spapp;');
%callback function [spapp.m]

apply_pb=uicontrol('Style','Pushbutton', ...
	'String','Apply' ,...
        'Units','normalized','Position',[.15 .14 .7 .08],...
        'Visible','on',...
        'Callback','App=1;spapp;');
%callback function [spapp.m]

return_pb=uicontrol('Style','Pushbutton',...
        'Units','normalized','Position',[.15 .04 .7 .08],...
        'Callback','close(Sset_f);close(Sdis_f); clear FF1 FB1',...
        'String','Return');

⌨️ 快捷键说明

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