syn_fire.m

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

M
255
字号
% syn_fire.m
% modified by D. G. Childers 8/10/98


timebegin = tartime(1);  % Tfirst->ttime;this vector is loaded with the art. para. file.
timeend = tartime(totfno)+tdur(totfno);  % Tend->ttime + Tend->tdur;totfno is loaded with the art. para. file.
Tdura = timeend - timebegin;
Nrepeat = ceil(Tdura / 0.0001) - 2;
smpfrq = 10000*(get(syn_10_h,'Value')+get(syn_20_h,'Value')*2+get(syn_30_h,'Value')*3+get(syn_40_h,'Value')*4+get(syn_50_h,'Value')*5+get(syn_60_h,'Value')*6);
Nstep = round(smpfrq / 10000.0) - 1;

if get(syn_areavtsyn_h,'Value')==1
	dpychoice=1;
elseif get(syn_artisyn_h,'Value')==1
	dpychoice=2;
elseif get(syn_tfpsdsyn_h,'Value')==1
	dpychoice=3;
end

cycle=floor((Nrepeat+1)/400);
remain=rem(Nrepeat+1,400);
currcycle=1;
plotindex=0;
if (max(exmode)==1 & min(exmode)==1)
	syndpymax=max(TN_vvdc)/3;
	premax=max(TN_vvdc)*2;
	volmax=max(TN_vvdc)*2;
else
	syndpymax=smpfrq*max(LF_ee)/100;
	premax=smpfrq*max(LF_ee)/2;
	volmax=smpfrq*max(LF_ee)/10;
end
syn_bak_h=syn_win1_h;
syn_win1_h=figure('Position',[170 70 630 150], 'NumberTitle','off',...
		'Resize','on','Name', 'Synthetic speech','MenuBar','none','color',BACK_COLOR);
syn_win2_h=figure('Position',[170 250 630 300], 'NumberTitle','off',...
		'Resize','on','Name','Data display','MenuBar','none','color',BACK_COLOR);
close(syn_bak_h);


	timeproc = timebegin
	sourcetime = -1.0;
	istartvt = 1;
	istartex = 1;

Uvvca = 0.0;Utotold = 0.0;Uv=zeros(1,62);Pv=zeros(1,62);Un=zeros(1,62);Pn=zeros(1,62);


%	tract;
%       if (tempex->exmode >= 1)
%               get_constriction();

%       excit(timeproc);
	excit;
	tract;
%       first3NTinterp(Ttemp);
%       NTarea2RLC();
	nt2rlc;
	area2rlc;

if explace(sfno) == 1
	tnloc = EX_loc(sfno);
	synrelo;
	for k=1:Nstep,
		synrelo2;
	end
else
	if (exmode(sfno)==1 | exmode(sfno)==2)
		turnoise;
	else
		tnnum=0;
	end
	syntest;
	for k=1:Nstep,
		syntest2;
	end
end
%plot(gUv)
%pause(1)
Utot = Uv(NING+1) + Un(NTsno+1);
speechsg(1) = Utot - Utotold;
Utotold = Utot;
if dpychoice==3
	presdpy(1,1)=Pv(20);
	presdpy(1,2)=Pv(30);
	presdpy(1,3)=Pv(40);
	presdpy(1,4)=Pv(50);
	uvdpy(1,1)=Uv(20);
	uvdpy(1,2)=Uv(30);
	uvdpy(1,3)=Uv(40);
	uvdpy(1,4)=Uv(50);
end
if dpychoice==2
	artidpy(1,1)=artset(1,1);
	artidpy(1,2)=artset(1,2);
	artidpy(1,3)=artset(1,3);
	artidpy(1,4)=artset(1,4);
	artidpy(1,5)=artset(1,5);
	artidpy(1,6)=artset(1,6);
	artidpy(1,7)=artset(1,7);
	artidpy(1,8)=artset(1,8);
	artidpy(1,9)=artset(1,9);
end

	istartvt = 0;
	istartex = 0;

for i1=1:Nrepeat,
		
	timeproc = timeproc + 0.0001
%	tract;
%       if (tempex->exmode >= 1)
%               get_constriction();

%       excit(timeproc);
	excit;
	tract;
%       first3NTinterp(Ttemp);
%       NTarea2RLC();
	nt2rlc;
	area2rlc;

if explace(sfno) == 1
	tnloc = EX_loc(sfno);
	synrelo1;
	for k=1:Nstep,
		synrelo2;
	end
else
	if (exmode(sfno)==1 | exmode(sfno)==2)
		turnoise;
	else
		tnnum=0;
	end
	syntest1;
	for k=1:Nstep,
		syntest2;
	end
end
	%plot(gUv)
	%pause(1)
	Utot = Uv(NING+1) + Un(NTsno+1);
	speechsg(i1+1) = Utot - Utotold;
	Utotold = Utot;
if dpychoice==3
	presdpy(i1+1,1)=Pv(20);
	presdpy(i1+1,2)=Pv(30);
	presdpy(i1+1,3)=Pv(40);
	presdpy(i1+1,4)=Pv(50);
	uvdpy(i1+1,1)=Uv(20);
	uvdpy(i1+1,2)=Uv(30);
	uvdpy(i1+1,3)=Uv(40);
	uvdpy(i1+1,4)=Uv(50);
end	
if dpychoice==2
	if totfno >= 2
		if vfno <= totfno-1

artidpy(i1+1,1)=artset(vfno,1)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,1)-artset(vfno,1))/tdur(vfno);
	artidpy(i1+1,2)=artset(vfno,2)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,2)-artset(vfno,2))/tdur(vfno);
	artidpy(i1+1,3)=artset(vfno,3)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,3)-artset(vfno,3))/tdur(vfno);
	artidpy(i1+1,4)=artset(vfno,4)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,4)-artset(vfno,4))/tdur(vfno);
	artidpy(i1+1,5)=artset(vfno,5)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,5)-artset(vfno,5))/tdur(vfno);
	artidpy(i1+1,6)=artset(vfno,6)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,6)-artset(vfno,6))/tdur(vfno);
	artidpy(i1+1,7)=artset(vfno,7)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,7)-artset(vfno,7))/tdur(vfno);
	artidpy(i1+1,8)=artset(vfno,8)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,8)-artset(vfno,8))/tdur(vfno);
	artidpy(i1+1,9)=artset(vfno,9)+((i1)/10000-tartime(vfno)+tartime(1))*(artset(vfno+1,9)-artset(vfno,9))/tdur(vfno);

		else

			artidpy(i1+1,1)=artset(vfno,1);
			artidpy(i1+1,2)=artset(vfno,2);
			artidpy(i1+1,3)=artset(vfno,3);
			artidpy(i1+1,4)=artset(vfno,4);
			artidpy(i1+1,5)=artset(vfno,5);
			artidpy(i1+1,6)=artset(vfno,6);
			artidpy(i1+1,7)=artset(vfno,7);
			artidpy(i1+1,8)=artset(vfno,8);
			artidpy(i1+1,9)=artset(vfno,9);
		
		end
	else
	
	artidpy(i1+1,1)=artset(1,1);
	artidpy(i1+1,2)=artset(1,2);
	artidpy(i1+1,3)=artset(1,3);
	artidpy(i1+1,4)=artset(1,4);
	artidpy(i1+1,5)=artset(1,5);
	artidpy(i1+1,6)=artset(1,6);
	artidpy(i1+1,7)=artset(1,7);
	artidpy(i1+1,8)=artset(1,8);
	artidpy(i1+1,9)=artset(1,9);
	
	end
end

	if currcycle <= cycle
		plotindex=plotindex+1
		if plotindex <= 399
			syndraw;
		else
			plotindex=0;
			close(syn_win1_h);
		syn_win1_h=figure('Position',[170 70 630 150], 'NumberTitle','off',...
				'Resize','on','Name','Synthetic speech','MenuBar','none','color',BACK_COLOR);
			currcycle=currcycle+1;
		end
	else
		plotindex=plotindex+1;
		if plotindex <= (remain-1)
			syndraw;
		end
	end
end
maxsp = max(abs(speechsg));
for i1=1:Nrepeat+1,
	speechsg(i1) = -speechsg(i1)/maxsp * 6000.0;
end

cd data
save speechsg.dat speechsg -ascii
cd ..

%  The following creates a message window telling
%  the user that the computation of the synthesized speech is 
%  completed.   D. G. Childers 8/18/98 

%  write message in command window
   disp('The computation of the synthetic speech is completed.');
   disp('The synthetic speech file has been written to the speechsg.dat file'); 
   disp('in the data folder.  ');
   disp('To save the synthesized speech to another file, press the Save button in the Articulatory synthesis window');
   disp('and follow the usual procedure.');
%  create message window and write message in that window also
   message_win3_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 computation of the synthetic speech is completed.');
text(-0.05,1,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('The synthetic speech file has been written to the speechsg.dat file');
text(-0.05,5/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('in the data folder.  ');
text(-0.05,4/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('To save the synthesized speech to another file, press the Save button in the Articulatory synthesis window');
text(-0.05,3/6,ss,'color',TEXT_COLOR,'FontSize',10);
ss=sprintf('and follow the usual procedure.');
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);

⌨️ 快捷键说明

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