📄 exe.m
字号:
% Script: exe.m is used to perform LPC-based analysis by exe_pb in a_win_f.
%
% speech = the input speech signal
% basic = [numf vt sr Order fram_len over_len m_len]
%
% for details, see exe0.m
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 1 get speech signal
if exist('speech')==0
warn_win_f1=figure('Unit','normalized',...
'Position',[.3 .5 .3 .1],...
'Numbertitle','off',...
'Name','Input Error!');
warn_text=uicontrol('Style','text',...
'Unit','normalized',...
'Position',[.1 .1 .8 .8],...
'String','Warning! The target speech is empty!');
return;
else
if exist('basic')==0
% set as default value
numf=5; % number of formant
vt=1; % vocal tract model: LP
sr=1; % source model: 6th order polynomial
Order=13; % LP order
fram_len=250;
over_len=50;
m_len=fram_len-over_len;
basic=[numf vt sr Order fram_len over_len m_len];
end
speech=filtfilt([1 -1],[1 -.99],speech); % Remove low-frequency drift
ntotal=length(speech);
nframe=floor(ntotal/m_len);
if (ntotal-nframe*m_len-Order) > 0
nframe=nframe+1;
end;
speech(ntotal+1:nframe*m_len+Order)=rand(1,nframe*m_len+Order-ntotal)-.5;
% Append noise at the end of the speech signal
ntotal=nframe*m_len+Order;
speech(ntotal)=0;
end
% clear previous data
clear vctyp gci ir cofa gm gpcf nidx ngm FF FB;
clear vctyp3 gci3 ir3 cofa3 gm3 gpcf3 nidx3 ngm3 FF3 FB3;
% 2 perform LP based analysis
showoff(ana_work_f,1);
figure(ana_work_f);
work_text1=uicontrol('Style','text',...
'Units','normalized',...
'Position',[.1 .7 .9 .2],...
'String','It is working! Please wait.',...
'BackGroundColor','white',...
'ForeGround',[0 0 1]);
drawnow;
work_text2=uicontrol('Style','text',...
'Units','normalized',...
'Position',[.1 .5 .9 .15],...
'String','Analysis begins ...',...
'BackGroundColor','white',...
'ForeGround',[0 0 1]);
work_text3=uicontrol('Style','text',...
'Units','normalized',...
'Position',[.1 .3 .9 .15],...
'String','',...
'BackGroundColor','white',...
'ForeGround',[0 0 1]); drawnow;
disp('Analysis starts...');
tic;
val=get(a_cb_cor,'Value');
if val==1 % manual correction
%--------------------------------------------------------%
% first stage LP analysis %
% >>> classify voicetype %
%--------------------------------------------------------%
[vctyp,cofa,rsd,ntotal,nframe]=lpana1(speech,basic);
time=toc;
set(work_text2,'String',['elapsed_time= ' num2str(time)]);
set(work_text1,'String','Voicetypes are classified.');
set(work_text3,'String','You may inspect the result');drawnow;
%disp('Voicetypes are classified.');
%set(a_pb_sv,'Visible','on');
% create GUI for manual correction
c_win_f=figure('Unit','normalized',...
'Position',[0.215 0.50 0.15 0.2],...
'Resize','off',...
'Color','white',...
'Numbertitle','off',...
'Name','Manual Correction');
c_pb_vtp=uicontrol('Style','Pushbutton',...
'Units','normalized',...
'Position',[0.05 0.6 0.9 0.3],...
'String','Voice Type Inspc.',...
'CallBack','Vchek;showoff(ana_work_f);');
% callback function [Vchek.m]
c_pb_close=uicontrol('Style','Pushbutton',...
'Units','normalized',...
'Position',[0.05 0.1 0.9 0.3],...
'String','Continue',...
'Callback','close(c_win_f);showoff(ana_work_f);exe1;');
else % no manual correction
%---------------------------------------------------------------------%
% total analysis without interruption %
% >>> classify voicetype, locate the gci and find formants* %
%---------------------------------------------------------------------%
if vt==1
[vctyp,gci,ir,cofa,gm,gpcf,nidx,ngm]=lpana(speech,basic);
elseif vt==2
[vctyp,gci,ir,cofa,FF,FB,gm,gpcf,nidx,ngm]=fbana(speech,basic);
end
time=toc;
set(work_text3,'String','You may save the result.');
set(work_text2,'String',['elapsed_time= ' num2str(time)]);
set(work_text1,'String','Analysis is done.'); drawnow;
set(a_pb_sv,'Visible','on');
disp('Analysis is done');
disp('You may save the result');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -