sa_start.m

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

M
260
字号
% sa_start
% modified by D. G. Childers 7/8/98


currf=get(m_curr_h,'String');
currf=eval(currf);

%initialize the art_set vector values for 10 through 12
if currf==1
   art_set(currf,10:12)=zeros(1,3);
end

art_set(currf,1)=get(m4_1_h,'Value');
art_set(currf,2)=get(m4_3_h,'Value');
art_set(currf,3)=get(m4_5_h,'Value');
art_set(currf,4)=get(m4_7_h,'Value');
art_set(currf,5)=get(m4_9_h,'Value');
art_set(currf,6)=get(m4_11_h,'Value');
art_set(currf,7)=get(m4_13_h,'Value');
art_set(currf,8)=get(m4_15_h,'Value');
art_set(currf,9)=get(m4_17_h,'Value');

artpre(currf,1)=art_set(currf,1);
artpre(currf,2)=art_set(currf,2);
artpre(currf,3)=art_set(currf,3);
artpre(currf,4)=art_set(currf,4);
artpre(currf,5)=art_set(currf,5);
artpre(currf,6)=art_set(currf,6);
artpre(currf,7)=art_set(currf,7);
artpre(currf,8)=art_set(currf,8);
artpre(currf,9)=art_set(currf,9);

if (exist('wh')==0 & exist('hk1')==0 & exist('g1k')==0)
	wh=1.34651;
	hk1=1.3431;
	g1k=0.82081;
end

if (get(opt_dim_h,'value')==1)
	Npara=8;
elseif (get(opt_dim_h,'value')==2)
	Npara=9;
elseif (get(opt_dim_h,'value')==3)
	Npara=11;
elseif (get(opt_dim_h,'value')==4)
	Npara=12;
end

currf=get(m_curr_h,'String');
currf=eval(currf);

Temp=get(sa_itemp_h,'Value')/100.0;
rT=get(sa_temprf_h,'Value')/100.0;
eps_sa=get(sa_errt_h,'Value')/1000.0;
NS=get(sa_cycle_h,'Value');
NT=get(sa_iter_h,'Value');
maxevl=get(sa_eval_h,'Value');
iseed1=get(sa_ran1_h,'Value');	
iseed2=get(sa_ran2_h,'Value');
iprint=1;
if (Npara==11 | Npara==12)
	pharyflag(currf)=1;
else
	pharyflag(currf)=0;
end

NEPS = 4;
	
	
	lb(1) = 0.0;
	ub(1) = 1000.0;
	lb(2) = 0.0;
	ub(2) = 1000.0;
	lb(3) = 0.0;
	ub(3) = 1000.0;
	lb(4) = 0.0;
	ub(4) = 1000.0;
	lb(5) = 0.0;
	ub(5) = 1000.0;
	lb(6) = 0.0;
	ub(6) = 1000.0;
	lb(7) = 0.0;
	ub(7) = 800.0;
	lb(8) = 0.0;
	ub(8) = 1000.0;  

	xvect(1) = art_set(currf,1);
	xvect(2) = art_set(currf,2);
	xvect(3) = art_set(currf,3);
	xvect(4) = art_set(currf,4);
	xvect(5) = art_set(currf,5);
	xvect(6) = art_set(currf,6);
	xvect(7) = art_set(currf,7);
	xvect(8) = art_set(currf,9);%
if Npara==9,
	lb(9) = 0.0;
	ub(9) = 519.0;
	xvect(9) = art_set(currf,8);%
elseif Npara==11,
	for j=9:Npara,
		lb(j)=0.0;
		ub(j)=1000.0;
	end
	
	xvect(9)=(wh-1.04651)/0.0006;
	xvect(10)=(hk1-1.2431)*5000.0;
	xvect(11)=(g1k-0.72)*5000.0;
elseif Npara==12,
	lb(9) = 0.0;
	ub(9) = 519.0;
	for j=10:Npara,
		lb(j)=0.0;
		ub(j)=1000.0;
	end
	xvect(9) = art_set(currf,8);%
	xvect(10)=(wh-1.04651)/0.0006;
	xvect(11)=(hk1-1.2431)*5000.0;
	xvect(12)=(g1k-0.72)*5000.0;
end
		
for j=1:Npara,
	c_sa(j) = 3.0;
	vm(j) = 10.0;
end


sa;
                  
xvect=xvect_last;  % see comment within sa.m about xvect_last.

	set(m4_1_h,'Value',xvect(1));
	set(m4_2_h,'String',round(xvect(1)));
	set(m4_3_h,'Value',xvect(2));
	set(m4_4_h,'String',round(xvect(2)));
	set(m4_5_h,'Value',xvect(3));
	set(m4_6_h,'String',round(xvect(3)));
	set(m4_7_h,'Value',xvect(4));
	set(m4_8_h,'String',round(xvect(4)));
	set(m4_9_h,'Value',xvect(5));
	set(m4_10_h,'String',round(xvect(5)));
	set(m4_11_h,'Value',xvect(6));
	set(m4_12_h,'String',round(xvect(6)));
	set(m4_13_h,'Value',xvect(7));
	set(m4_14_h,'String',round(xvect(7)));
	if (Npara==9 | Npara==12)
		set(m4_15_h,'Value',xvect(9));
		set(m4_16_h,'String',round(xvect(9)));
	else
		set(m4_15_h,'Value',0);
		set(m4_16_h,'String',0);
	end
	set(m4_17_h,'Value',xvect(8));
	set(m4_18_h,'String',round(xvect(8)));

	art_set(currf,1)=xvect(1);
	art_set(currf,2)=xvect(2);
	art_set(currf,3)=xvect(3);
	art_set(currf,4)=xvect(4);
	art_set(currf,5)=xvect(5);
	art_set(currf,6)=xvect(6);
	art_set(currf,7)=xvect(7);
	art_set(currf,9)=xvect(8);
if Npara==8,
	art_set(currf,8)=artvelum;
	wh=1.34651;
	hk1=1.3431;
	g1k=0.82081;
elseif Npara==9,
	art_set(currf,8)=xvect(9);
	wh=1.34651;
	hk1=1.3431;
	g1k=0.82081;
elseif Npara==11,
	art_set(currf,8)=artvelum;
	art_set(currf,9) = 1.04651+0.0006*xvect(9);
	art_set(currf,10) = 1.2431+0.0002*xvect(10);
	art_set(currf,11) = 0.72+0.0002*xvect(11);
	wh=1.04651+0.0006*xvect(9);
	hk1=xvect(10)/5000.0+1.2431;
	g1k=xvect(11)/5000.0+0.72;
elseif Npara==12,
	art_set(currf,8) =  xvect(9);
	art_set(currf,10) = 1.04651+0.0006*xvect(10);
	art_set(currf,11) = 1.2431+0.0002*xvect(11);
	art_set(currf,12) = 0.72+0.0002*xvect(12);
	wh=1.04651+0.0006*xvect(10);
	hk1=xvect(11)/5000.0+1.2431;
	g1k=xvect(12)/5000.0+0.72;
end
%
artpre(currf,1)=art_set(currf,1);
artpre(currf,2)=art_set(currf,2);
artpre(currf,3)=art_set(currf,3);
artpre(currf,4)=art_set(currf,4);
artpre(currf,5)=art_set(currf,5);
artpre(currf,6)=art_set(currf,6);
artpre(currf,7)=art_set(currf,7);
artpre(currf,8)=art_set(currf,8);
artpre(currf,9)=art_set(currf,9);
%
% now update the plot in the main window
sagiplot;

%  The following creates a message window telling
%  the user that the simulated annealing computation is 
%  completed for the current frame.   D. G. Childers 7/8/98 

%  write message in command window
   disp('The simulated annealing computations for this frame have been completed.');
   disp('The articulatory positions have been updated in the'); 
	disp('Articulatory Positions Settings Window.');
%  create message window and write message in that window also
   message_win_f=figure('Unit','normalized',...
           'Position',[0.05 0.5 0.9 0.2],...
           'Resize','off',...
           'Color',BACK_COLOR,...
           'Numbertitle','off',...
           'Name','Message');
axis('off');        
ss=sprintf('The simulated annealing computations for this frame have been completed.');
text(-0.05,1,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('The articulatory positions have been updated in the Articlatory Positions Settings Window.');
text(-0.05,2/3,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('You may now close this message window.');
text(-0.05,1/3,ss,'color',TEXT_COLOR,'FontSize',10);

if currf==totfno
framopt;
%  The following creates a message window telling
%  the user that the simulated annealing computation is 
%  completed for all frames.   D. G. Childers 7/8/98 

%  write message in command window
   disp('The simulated annealing computations for all frames have been completed.');
   disp('The articulatory positions have been written to a file'); 
   disp('in framopt.m.  The file name is artset.');
   disp('To save this file, press the File button in the main window');
   disp('then select save.');
%  create message window and write message in that window also
   message_win2_f=figure('Unit','normalized',...
           'Position',[0.05 0.2 0.9 0.2],...
           'Resize','off',...
           'Color',BACK_COLOR,...
           'Numbertitle','off',...
           'Name','Message');
axis('off');        
ss=sprintf('The simulated annealing computations for all frames have been completed.');
text(-0.05,1,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('The articulatory positions have been written to a file');
text(-0.05,5/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('in framopt.m.  The file name is artset.');
text(-0.05,4/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('To save this file, press the File button in the main window');
text(-0.05,3/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('then select save.');
text(-0.05,2/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('You may now close this message window.');
text(-0.05,1/6,ss,'color',TEXT_COLOR,'FontSize',10);
end

⌨️ 快捷键说明

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