📄 analy_1c.m
字号:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% analy_1c.m
%
% jmw and Dr. Hu
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Modified by Karthik
%Modified by D. G. Childers
wait_window = figure('Numbertitle','off',...
'Color',BACK_COLOR,...
'Name','Please wait',...
'Position',[117 248 560 150]);
pause(0.01)
signal=SPEECH';
wait_counter = 0;
% Normalize the amplitude of the analyzing signal
signal=14000/max(abs(signal))*signal;
% Remove components around d.c.
signal=filtfilt([1 -1],[1 -.99],signal);
% Segmentize the underlying signal
ntotal=length(signal);
old_ntotal = ntotal;
nframe=floor(ntotal/200);
if ntotal-nframe*200-13 > 0
nframe=nframe+1;
end;
ntotal=nframe*200+13;
signal(ntotal)=0;
for i=old_ntotal+1:ntotal,
signal(i)=rand(1) - 0.5;
end;
cofa=zeros(nframe,14);
curmaxp=zeros(1,nframe);
compa=1e7;
wait_window_slider = uicontrol('Style','Slider',...
'Position',[50 100 410 30],...
'Max',nframe,...
'Min',0,...
'Value',wait_counter);
wait_window_display = uicontrol('Style','Text',...
'Position',[50 50 410 30],...
'Backgroundcolor','white',...
'Foregroundcolor','blue',...
'String','Please wait while the location of the GCIs are being calculated');
pause(0.01);
% Calculate the lpc coefficients and get residue;
% Please see "lpc_1a.m" for the I/O arguments.
% ********************* do for FIRST segment *************************
sso=signal(1:250+13);
[cofa1,emp(1),energy(1),residue1]=lpc_1a(sso,num_poles-1);
residue1=sqrt(energy(1)/(residue1*residue1'))*residue1;
cofa(1,:)=cofa1;
residue(14:250+13)=residue1;
ss1=residue1(201:250);
wait_counter =1;
set(wait_window_slider,'value',wait_counter);
% ******************** do for middle segments ************************
for k=2:nframe-1
sso=signal((k-1)*200+1:k*200+13+50);
[cofa1,emp(k),energy(k),residue1]=lpc_1a(sso,num_poles-1);
residue1=sqrt(energy(k)/(residue1*residue1'))*residue1;
energy1=sso(1+13:100+13)*sso(1+13:100+13)';
energy2=sso(101+13:200+13)*sso(101+13:200+13)';
energyidx(k)=sqrt(energy1*energy2);
ss2=residue1(1:50);
ss=(ss1.*(50:-1:1)+ss2.*(1:50))/51;
residue((k-1)*200+14:k*200+50+13)=[ss residue1(51:250)];
ss1=residue1(201:250);
cofa(k,1:length(cofa1))=cofa1;
wait_counter = wait_counter+1;
set(wait_window_slider,'value',wait_counter);
end;
% ***************** do for LAST segment *******************************
k=nframe;
sso=signal((k-1)*200+1:k*200+13);
[cofa1,emp(k),energy(k),residue1]=lpc_1a(sso,num_poles-1);
residue1=sqrt(energy(k)/(residue1*residue1'))*residue1;
energy1=sso(1+13:100+13)*sso(1+13:100+13)';
energy2=sso(101+14:200+13)*sso(101+14:200+13)';
energyidx(k)=sqrt(energy1*energy2);
ss2=residue1(1:50);
ss=(ss1.*(50:-1:1)+ss2.*(1:50))/51;
residue((k-1)*200+14:k*200+13)=[ss residue1(51:200)];
cofa(k,1:length(cofa1))=cofa1;
wait_counter = nframe;
set(wait_window_slider,'value',wait_counter);
set(wait_window_display,'String','LP Analysis over...Doing V/UV classification');
pause(0.01);
% *************************** V/U classification **************
voicetype(1)=0;
for kf=2:nframe-1
if emp(kf)>.2 & energyidx(kf)>3*compa
%if emp(kf)>.4 & energyidx(kf)>3*compa % hu's fix to elim false V detection
voicetype(kf)=1;
else
voicetype(kf)=0;
end;
end;
voicetype(nframe)=0;
% ************************* eliminate UVU and VUV possibilities *******
for k=2:nframe-1
if sum(voicetype(k-1:k+1)) > 1
voicetype(k)=1;
else
voicetype(k)=0;
end;
end;
set(wait_window_display,'String','Saving variables to temp.mat file');
pause(0.01);
save temp cofa energy residue emp voicetype nframe ntotal;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -