⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 exe4.m

📁 这是一个用于语音信号处理的工具箱
💻 M
字号:
% Script : execute the speech synthesis process

    %---------------------------%
    %  get the necessary data   %
    %---------------------------%

set(work_f,'Visible','on');
set(work_text1,'String','It is working.  Please wait.');
pause(1)

if exist('vctyp3')==0
   vctyp3=vctyp;
end

if exist('gci3')==0
   gci3=gci;
end

if exist('cofa3')==0
   cofa3=cofa;
end

if exist('gm3')==0
   gm3=gm;
end

if exist('gpcf3')==0
   gpcf3=gpcf;
end

if exist('nidx3')==0
   nidx3=nidx;
end

if exist('ngm3')==0
   ngm3=ngm;
end


     %--------------------------%
     %  synthesize the speech   %
     %--------------------------%

if vt==1
   [synspch,synexc]=lpsyn(vctyp3,gci3,cofa3,gm3,gpcf3,nidx3,ngm3,basic);
elseif vt==2
      if exist('FF3')==0
         FF3=FF;
      end
      if exist('FB3')==0
         FB3=FB;
      end

   [synspch,synexc]=fbsyn(vctyp3,gci3,cofa3,FF3,FB3,gm3,gpcf3,nidx3,ngm3,basic);
end


 set(work_text1,'String','Synthesis is done.  You may save it.');
 disp('Synthesis is done');
 set(s_pb_sv,'Visible','on');


     %--------------------------------------------------------------%
     %  create 'd_win_f' window for displaying the original speech  %
     %           & the synthesized speech                           %
     %--------------------------------------------------------------%

if exist('speech2')==1  % voice conversion: display original,target and converted speech
       
     d_win_f=figure('Unit','normalized',...
        'Position',[0.165 0.05 0.82 0.8],...
        'Resize','on',...
        'Visible','on',...
        'Color',[.5 .5 .5],...
        'Numbertitle','off',...
        'Name','Original & Synthesized & Target Speech Signal Display');

     whitebg(d_win_f,'w');
     ax1=axes('Position',[0.05 0.70 0.8 0.24]);
     ax2=axes('Position',[0.05 0.38 0.8 0.24]);
     ax3=axes('Position',[0.05 0.05 0.8 0.24]);
     
     play0_pb=uicontrol('Style','Pushbutton', ...
	'String','play','Units','normalized','Position',[.88 .87 .095 .05],...
        'Callback', 'play(speech1);');
     spec0_pb=uicontrol('Style','Pushbutton', ...
	'String','spectrogram','Units','normalized','Position',[.88 .80 .095 .05],...
    'Callback', 'sgram1');

     wave0_pb=uicontrol('Style','Pushbutton', ...
	'String','waveform','Units','normalized','Position',[.88 .73 .095 .05],...
       'Callback', 'axes(ax1);plot(speech1,''color'', LINE_COLOR);title(''Original speech'');');

    play1_pb=uicontrol('Style','Pushbutton', ...
	'String','play','Units','normalized','Position',[.88 .55 .095 .05],...
        'Callback', 'play(synspch);');
     spec1_pb=uicontrol('Style','Pushbutton', ...
	'String','spectrogram','Units','normalized','Position',[.88 .48 .095 .05],...
  'Callback', 'sgram2' );

     wave1_pb=uicontrol('Style','Pushbutton', ...
	'String','waveform','Units','normalized','Position',[.88 .41 .095 .05],...
        'Callback', 'axes(ax2);plot(synspch,''color'',LINE_COLOR);title(''Synthesized speech'');');

     play2_pb=uicontrol('Style','Pushbutton', ...
	'String','play','Units','normalized','Position',[.88 .22 .095 .05],...
        'Callback', 'play(speech2);');
     spec2_pb=uicontrol('Style','Pushbutton', ...
	'String','spectrogram','Units','normalized','Position',[.88 .15 .095 .05],...
    'Callback', 'sgram3' );

     wave2_pb=uicontrol('Style','Pushbutton', ...
	'String','waveform','Units','normalized','Position',[.88 .08 .095 .05],...
       'Callback', 'axes(ax3);plot(speech2,''color'',LINE_COLOR);title(''Target speech'');');

%     close_pb=uicontrol('Style','Pushbutton', ...
%	'String','return','Units','normalized','Position',[.88 .01 .095 .05],...
%        'Callback', 'close(d_win_f);clear speech2;');

     close_pb=uicontrol('Style','Pushbutton', ...
	'String','return','Units','normalized','Position',[.88 .01 .095 .05],...
        'Callback', 'close(d_win_f);');

     axes('Position',[.05 .05 .8 .9],'Box','on','Visible','off');

     axes(ax1); plot(speech1,'color',LINE_COLOR); title('Original speech');
     axes(ax2); plot(synspch,'color',LINE_COLOR); title('Synthesized speech');
     axes(ax3); plot(speech2,'color',LINE_COLOR); title('Target speech');

     %speech=speech2;
     %return;
     
     %end
     
 elseif exist('speech2')==0  % voice conversion: display original and synthesized speech

 d_win_f=figure('Unit','normalized',...
        'Position',[0.165 0.2 0.82 0.5],...
        'Resize','on',...
        'Visible','on',...
        'Color',[.5 .5 .5],...
        'Numbertitle','off',...
        'Name','Original & Synthesized Speech Signal Display');

 whitebg(d_win_f,'w');
ax1=axes('Position',[0.08 0.56 0.8 0.37]);
ax2=axes('Position',[0.08 0.07 0.8 0.37]);

play0_pb=uicontrol('Style','Pushbutton', ...
	'String','play','Units','normalized','Position',[.9 .87 .09 .07],...
        'Callback', 'play(speech);');
spec0_pb=uicontrol('Style','Pushbutton', ...
	'String','spectrogram','Units','normalized','Position',[.9 .78 .09 .07],...
    'Callback', 'sgram4' );

wave0_pb=uicontrol('Style','Pushbutton', ...
	'String','waveform','Units','normalized','Position',[.9 .69 .09 .07],...
       'Callback', 'axes(ax1);plot(speech,''color'',LINE_COLOR);title(''Original speech'');');

play1_pb=uicontrol('Style','Pushbutton', ...
	'String','play','Units','normalized','Position',[.9 .38 .09 .07],...
        'Callback', 'play(synspch);');
spec1_pb=uicontrol('Style','Pushbutton', ...
	'String','spectrogram','Units','normalized','Position',[.9 .29 .09 .07],...
  'Callback', 'sgram2' );

wave1_pb=uicontrol('Style','Pushbutton', ...
	'String','waveform','Units','normalized','Position',[.9 .2 .09 .07],...
        'Callback', 'axes(ax2);plot(synspch,''color'',LINE_COLOR);title(''Synthesized speech'');');


close_pb=uicontrol('Style','Pushbutton', ...
	'String','return','Units','normalized','Position',[.9 .1 .09 .07],...
        'Callback', 'close(d_win_f);');

axes('Position',[.05 .05 .8 .9],'Box','on','Visible','off');

axes(ax1); plot(speech,'color',LINE_COLOR); title('Original speech');
axes(ax2); plot(synspch,'color',LINE_COLOR); title('Synthesized speech');

end

⌨️ 快捷键说明

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