mgif_ps.m
来自「这是一个用于语音信号处理的工具箱」· M 代码 · 共 369 行
M
369 行
%
% Manuall glottal inverse filtering algorithm
% The inverse filter can be adjusted by hand using formant frequency
% and bandwidths.
% Author : Minkyu Lee
% Date 10-Oct-1994
%
mgif_ps_flag=1;
clear dg_final g_final gci_m;
clear GVV DGVV RESIDUE TRACK ;
GVV=zeros(size(SPEECH));
DGVV=zeros(size(SPEECH));
RESIDUE=zeros(size(SPEECH));
TRACK=zeros(size(SPEECH),6);
dg_final = GVV;
g_final = GVV;
% If the end points of analysis frame is not defined, return
if exist('LEFT') ~=1 | exist('RIGHT') ~= 1
disp('Please select the analysis frame first');
return;
end
ext_left=200; % Extra points for manual GIF
ext_right=200; % Extra points for manual GIF
if NEW_LEFT-ext_left <= 0
ext_left=NEW_LEFT-1;
end
if NEW_RIGHT+ext_right >= NEW_LEN
ext_right=NEW_LEN-NEW_RIGHT;
end
S=sprintf('./track/out/%s_g.mat',name);
analy_1c;
pkpk_1c;
num_gci=length(gci);
gci_m = gci;
num_gci=length(gci_m);
cur_gci=1;
if cur_gci == num_gci
disp('It is the end of this analysis frame')
cur_gci=cur_gci-1;
end
ydata_m=SPEECH_OLD(gci_m(cur_gci)-ext_left:gci_m(cur_gci+1)+ext_right);
mgif_es;
% Define some character strings for future use
S_g =sprintf('Filter Gain. [dB] :');
S_ff1=sprintf('1st fmt freq.[Hz] :');
S_fb1=sprintf(' bwd. [Hz] :');
S_ff2=sprintf('2nd fmt freq.[Hz] :');
S_fb2=sprintf(' bwd. [Hz] :');
S_ff3=sprintf('3rd fmt freq.[Hz] :');
S_fb3=sprintf(' bwd. [Hz] :');
S_ff4=sprintf('4th fmt freq.[Hz] :');
S_fb4=sprintf(' bwd. [Hz] :');
S_ff5=sprintf('5th fmt freq.[Hz] :');
S_fb5=sprintf(' bwd. [Hz] :');
% Open control box for manual inverse filtering
PV=[2 22 290 388];
s2 = 'Manual GIF control box';
% Open analysis window
while exist('mgif_con_win_h')==1
try1 = 'get(mgif_con_win_h,''position'');';
eval(try1,catch2);
if check ==0
clear mgif_con_win_h;
check = 1;
break;
end
s1 = get(mgif_con_win_h,'Name');
if ~strcmp(s1,s2)
clear mgif_con_win_h;
break;
end
figure(mgif_con_win_h);
break;
end;
if exist('mgif_con_win_h')~=1;
mgif_con_win_h=figure('Position',PV,...
'Resize','on',...
'Numbertitle','off',...
'color',BACK_COLOR,...
'Name',s2);
%
% Design the control box
%
% for gain slide bar
mgif_txt_gain_h=uicontrol('Style','Pushbutton',...
'Position',[10 350 120 20],...
'String',S_g);
S1=sprintf('gain=mgif_e2s(mgif_sl_gain_h, mgif_ed_gain_h);');
mgif_ed_gain_h=uicontrol('Style','edit',...
'Position',[140 350 40 20],...
'Callback',S1,...
'String',gain);
S1=sprintf('gain=mgif_s2e(mgif_ed_gain_h, mgif_sl_gain_h);');
mgif_sl_gain_h=uicontrol('Style','slider',...
'Position',[190 350 100 20],...
'Callback',S1,...
'Max',200,...
'Min',1,...
'Value',gain);
% for ff1 slide bar
mgif_txt_ff1_h=uicontrol('Style','Pushbutton',...
'Position',[10 320 120 20],...
'String',S_ff1);
S1=sprintf('ff(1)=mgif_e2s(mgif_sl_ff1_h, mgif_ed_ff1_h);');
mgif_ed_ff1_h=uicontrol('Style','edit',...
'Position',[140 320 40 20],...
'Callback',S1,...
'String',ff(1));
S1=sprintf('ff(1)=mgif_s2e(mgif_ed_ff1_h, mgif_sl_ff1_h);');
mgif_sl_ff1_h=uicontrol('Style','slider',...
'Position',[190 320 100 20],...
'Callback',S1,...
'Max',2000,...
'Min',0,...
'Value',ff(1));
% for fb1 slide bar
mgif_txt_fb1_h=uicontrol('Style','Pushbutton',...
'Position',[10 290 120 20],...
'String',S_fb1);
S1=sprintf('fb(1)=mgif_e2s(mgif_sl_fb1_h, mgif_ed_fb1_h);');
mgif_ed_fb1_h=uicontrol('Style','edit',...
'Position',[140 290 40 20],...
'Callback',S1,...
'String',fb(1));
S1=sprintf('fb(1)=mgif_s2e(mgif_ed_fb1_h, mgif_sl_fb1_h);');
mgif_sl_fb1_h=uicontrol('Style','slider',...
'Position',[190 290 100 20],...
'Callback',S1,...
'Max',2000,...
'Min',0,...
'Value',fb(1));
% for ff2 slide bar
mgif_txt_ff2_h=uicontrol('Style','Pushbutton',...
'Position',[10 260 120 20],...
'String',S_ff2);
S1=sprintf('ff(2)=mgif_e2s(mgif_sl_ff2_h, mgif_ed_ff2_h);');
mgif_ed_ff2_h=uicontrol('Style','edit',...
'Position',[140 260 40 20],...
'Callback',S1,...
'String',ff(2));
S1=sprintf('ff(2)=mgif_s2e(mgif_ed_ff2_h, mgif_sl_ff2_h);');
mgif_sl_ff2_h=uicontrol('Style','slider',...
'Position',[190 260 100 20],...
'Callback',S1,...
'Max',3500,...
'Min',0,...
'Value',ff(2));
% for fb2 slide bar
mgif_txt_fb2_h=uicontrol('Style','Pushbutton',...
'Position',[10 230 120 20],...
'String',S_fb2);
S1=sprintf('fb(2)=mgif_e2s(mgif_sl_fb2_h, mgif_ed_fb2_h);');
mgif_ed_fb2_h=uicontrol('Style','edit',...
'Position',[140 230 40 20],...
'Callback',S1,...
'String',fb(2));
S1=sprintf('fb(2)=mgif_s2e(mgif_ed_fb2_h, mgif_sl_fb2_h);');
mgif_sl_fb2_h=uicontrol('Style','slider',...
'Position',[190 230 100 20],...
'Callback',S1,...
'Max',2000,...
'Min',0,...
'Value',fb(2));
% for ff3 slide bar
mgif_txt_ff3_h=uicontrol('Style','Pushbutton',...
'Position',[10 200 120 20],...
'String',S_ff3);
S1=sprintf('ff(3)=mgif_e2s(mgif_sl_ff3_h, mgif_ed_ff3_h);');
mgif_ed_ff3_h=uicontrol('Style','edit',...
'Position',[140 200 40 20],...
'Callback',S1,...
'String',ff(3));
S1=sprintf('ff(3)=mgif_s2e(mgif_ed_ff3_h, mgif_sl_ff3_h);');
mgif_sl_ff3_h=uicontrol('Style','slider',...
'Position',[190 200 100 20],...
'Callback',S1,...
'Max',5000,...
'Min',0,...
'Value',ff(3));
% for fb3 slide bar
mgif_txt_fb3_h=uicontrol('Style','Pushbutton',...
'Position',[10 170 120 20],...
'String',S_fb3);
S1=sprintf('fb(3)=mgif_e2s(mgif_sl_fb3_h, mgif_ed_fb3_h);');
mgif_ed_fb3_h=uicontrol('Style','edit',...
'Position',[140 170 40 20],...
'Callback',S1,...
'String',fb(3));
S1=sprintf('fb(3)=mgif_s2e(mgif_ed_fb3_h, mgif_sl_fb3_h);');
mgif_sl_fb3_h=uicontrol('Style','slider',...
'Position',[190 170 100 20],...
'Callback',S1,...
'Max',2000,...
'Min',0,...
'Value',fb(3));
% for ff4 slide bar
mgif_txt_ff4_h=uicontrol('Style','Pushbutton',...
'Position',[10 140 120 20],...
'String',S_ff4);
S1=sprintf('ff(4)=mgif_e2s(mgif_sl_ff4_h, mgif_ed_ff4_h);');
mgif_ed_ff4_h=uicontrol('Style','edit',...
'Position',[140 140 40 20],...
'Callback',S1,...
'String',ff(4));
S1=sprintf('ff(4)=mgif_s2e(mgif_ed_ff4_h, mgif_sl_ff4_h);');
mgif_sl_ff4_h=uicontrol('Style','slider',...
'Position',[190 140 100 20],...
'Callback',S1,...
'Max',5000,...
'Min',0,...
'Value',ff(4));
% for fb4 slide bar
mgif_txt_fb4_h=uicontrol('Style','Pushbutton',...
'Position',[10 110 120 20],...
'String',S_fb4);
S1=sprintf('fb(4)=mgif_e2s(mgif_sl_fb4_h, mgif_ed_fb4_h);');
mgif_ed_fb4_h=uicontrol('Style','edit',...
'Position',[140 110 40 20],...
'Callback',S1,...
'String',fb(4));
S1=sprintf('fb(4)=mgif_s2e(mgif_ed_fb4_h, mgif_sl_fb4_h);');
mgif_sl_fb4_h=uicontrol('Style','slider',...
'Position',[190 110 100 20],...
'Callback',S1,...
'Max',2000,...
'Min',0,...
'Value',fb(4));
% for ff5 slide bar
mgif_txt_ff5_h=uicontrol('Style','Pushbutton',...
'Position',[10 80 120 20],...
'String',S_ff5);
S1=sprintf('ff(5)=mgif_e2s(mgif_sl_ff5_h, mgif_ed_ff5_h);');
mgif_ed_ff5_h=uicontrol('Style','edit',...
'Position',[140 80 40 20],...
'Callback',S1,...
'String',ff(5));
S1=sprintf('ff(5)=mgif_s2e(mgif_ed_ff5_h, mgif_sl_ff5_h);');
mgif_sl_ff5_h=uicontrol('Style','slider',...
'Position',[190 80 100 20],...
'Callback',S1,...
'Max',6000,...
'Min',0,...
'Value',ff(5));
% for fb5 slide bar
mgif_txt_fb5_h=uicontrol('Style','Pushbutton',...
'Position',[10 50 120 20],...
'String',S_fb5);
S1=sprintf('fb(5)=mgif_e2s(mgif_sl_fb5_h, mgif_ed_fb5_h);');
mgif_ed_fb5_h=uicontrol('Style','edit',...
'Position',[140 50 40 20],...
'Callback',S1,...
'String',fb(5));
S1=sprintf('fb(5)=mgif_s2e(mgif_ed_fb5_h, mgif_sl_fb5_h);');
mgif_sl_fb5_h=uicontrol('Style','slider',...
'Position',[190 50 100 20],...
'Callback',S1,...
'Max',2000,...
'Min',0,...
'Value',fb(5));
mgif_pb_go_h=uicontrol('Style','pushbutton',...
'Position',[12 10 60 30],...
'Callback','mgif_go',...
'String','Go');
mgif_pb_can_h=uicontrol('Style','pushbutton',...
'Position',[84 10 60 30],...
'Callback','mgif_sa;mgif_ps2',...
'String','Save');
mgif_pb_re_h=uicontrol('Style','pushbutton',...
'Position',[156 10 60 30],...
'Callback','mgif_sas;mgif_ps2',...
'String','Save as');
mgif_pb_re_h=uicontrol('Style','pushbutton',...
'Position',[228 10 60 30],...
'Callback','mgif_ca',...
'String','Cancel');
else
set(mgif_sl_gain_h,'Value',gain);
set(mgif_sl_ff1_h,'Value',ff(1));
set(mgif_sl_fb1_h,'Value',fb(1));
set(mgif_sl_ff2_h,'Value',ff(2));
set(mgif_sl_fb2_h,'Value',fb(2));
set(mgif_sl_ff3_h,'Value',ff(3));
set(mgif_sl_fb3_h,'Value',fb(3));
set(mgif_sl_ff4_h,'Value',ff(4));
set(mgif_sl_ff4_h,'Value',ff(4));
set(mgif_sl_fb5_h,'Value',fb(5));
set(mgif_sl_fb5_h,'Value',fb(5));
end
PV=[270 302 515 268];
s2 = 'MGIF - Filter Characteristic';
% Open analysis window
while exist('mgif_plot_win_h')==1
try1 = 'get(mgif_plot_win_h,''position'');';
eval(try1,catch2);
if check ==0
clear mgif_plot_win_h;
check = 1;
break;
end
s1 = get(mgif_plot_win_h,'Name');
if ~strcmp(s1,s2)
clear mgif_plot_win_h;
break;
end
figure(mgif_plot_win_h);
break;
end;
if exist('mgif_plot_win_h')~=1;
mgif_plot_win_h=figure('Position',PV,...
'Resize','on',...
'Numbertitle','off',...
'Name',s2);
end
mgif_go;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?