twomass_go.m

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

M
138
字号
%Callback function for the go button of the Twomass model  parameter and controls window
%Author : Karthik
% modified by D. G. Childers 5/20/98
%
%
%This program reads the values for the various parameters from the 
%control windows.  Then the various coefficients are determined from 
%these parameters.  The functions for drawing the vocal fold static 
%configuration are called from this program.
%

Length  = eval(get(twomass_con_length_edit,'String'));			%Length of the vocal fold
Width = eval(get(twomass_con_width_edit,'String'));          	%Width of the vocal fold
Thickness = eval(get(twomass_con_thickness_edit,'String'));		%Thickness of the vocal fold

m1 = eval(get(twomass_con_m1_edit,'String'));		%Mass 1
m2 = eval(get(twomass_con_m2_edit,'String'));		%Mass 2

%Get the thickness of the two masses
d1 = eval(get(twomass_con_d1_edit,'String'));		%Mass 1 Thickness
d2 = eval(get(twomass_con_d2_edit,'String'));		%Mass 2 Thickness
Thickness=d1+d2;  %override the thickness value in vocal fold dimensions

Q =  eval(get(twomass_con_Q_edit,'String'));	 	%Fundamental Frequency factor
No_of_Segments = eval(get(twomass_con_segments_edit,'String'));

%The vocal tract area function is assumed to be a constant.

val = eval(get(twomass_con_A_edit,'String'));
A = val;

%Get the pressure value from the Model Window
Pressure = eval(get(twomass_con_Ps_edit,'String'));
%Excursion of the inferior edge of the vocal folds from the glottal midline
excursion_1 = eval(get(twomass_con_excur1_edit,'String'));	

%Excursion of the superior edge of the vocal cords from the glottal midline
excursion_2 = eval(get(twomass_con_excur2_edit,'String'));	


%Now specify the excursions as a percentage of vocal fold width
excursion_1_percent = (excursion_1/Width)*100;
excursion_2_percent = (excursion_2/Width)*100;

%Specify the model parameters in a vector
MODEL_PARAMETERS = [Length Width Thickness Pressure m1 m2 d1 d2 ...
      excursion_1 excursion_2 Q A No_of_Segments];


%Initialize plotting windows
%This special procedure is used to initialize plotting windows to ensure
%that the window will be opened if it already exists and a new window will be
%created otherwise. 

PV = [10 250 400 288];
s2 = 'Twomass Vocal Fold Configuration -1';

% Open analysis window
while exist('twomass_output_window_1')==1
   try1 = 'get(twomass_output_window_1,''position'');';
   eval(try1,catch2);
   if check ==0
      clear twomass_output_window_1;
      check = 1;
      break;
   end
   s1 = get(twomass_output_window_1,'Name');
   if ~strcmp(s1,s2)
      clear twomass_output_window_1;
      break;
   end
   figure(twomass_output_window_1);
   break;
end;

if exist('twomass_output_window_1')~=1;
   twomass_output_window_1=figure('Position',PV,...
      'Resize','on',...
      'Numbertitle','off',...
      'Name',s2 );
end

%Now draw the vocal fold 2D configuration
%Call the file static_config_draw to draw the configuration
%For more information type help static_config_draw at the command prompt

figure(twomass_output_window_1);
clf;
axes('position', [0.1 0.67 0.8 0.33])    %The upper third of the figure for the 2D view
%twomass_draw(excursion_1_percent,excursion_2_percent,Thickness);
twomass_draw(excursion_1_percent,excursion_2_percent,d1,d2);
view(2);               %2D view of the vocal folds


axes('position',[0.1 0.1 0.9 0.6]);     %The lower two thirds for the 3D view
%twomass_draw(excursion_1_percent,excursion_2_percent,Thickness);
twomass_draw(excursion_1_percent,excursion_2_percent,d1,d2);
%axis([0 200 0 200 0 2*Thickness]);
axis([0 200 0 200 0 2*(d1+d2)]);



%Vocal fold pre phonatory shape
PV = [380 48 410 286];
s2 = 'Twomass Vocal Fold Pre-Phonatory Shape';

% Open analysis window
while exist('twomass_output_window_2')==1
   try1 = 'get(twomass_output_window_2,''position'');';
   eval(try1,catch2);
   if check ==0
      clear twomass_output_window_2;
      check = 1;
      break;
   end
   s1 = get(twomass_output_window_2,'Name');
   if ~strcmp(s1,s2)
      clear twomass_output_window_2;
      break;
   end
   figure(twomass_output_window_2);
   break;
end;

if exist('twomass_output_window_2')~=1;
   twomass_output_window_2=figure('Position',PV,...
      'Resize','on',...
      'Numbertitle','off',...
      'Name',s2 );
end

%Call function to draw the pre phonatory shape
%For more help type help pre_phonatory_shape_draw
clf;
%twomass_prephonatory_draw(excursion_1_percent,excursion_2_percent);
twomass_prephonatory_draw(excursion_1_percent,excursion_2_percent,d1,d2);

clc;

⌨️ 快捷键说明

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