📄 ftrack.asv
字号:
function ftrack(action)
% Show the formant track
%
% Copyright (c) 1995 by Philipos C. Loizou
%
global nChannels filename filterA filterB Srate ftrFig
global HDRSIZE S0 S1 ratePps En Be bl al WAV1 n_Secs En2 Be2
global filename2 TWOFILES n_Secs2 Srate2 TOP HDRSIZE2 fFig
global saveFmnts clsedFrm ftype ftype2 bpsa bpsa2
pos = get(0, 'screensize'); % get the screensize
sWi = pos(3);
sHe = pos(4);
WIDTH =round(0.9375*sWi);
HEIGHT = round(0.5*sHe);
LEFT =round(0.025*sWi);
BOTTOM =20;
if isempty(saveFmnts)
saveFmnts=0;
end
if isempty(clsedFrm)
clsedFrm=1;
end
if TWOFILES==1 & TOP==1
fname=filename2;
offSet=Be2*bpsa2+HDRSIZE2;
n_samples=En2-Be2; %round(n_Secs2*Srate2)
ftp=ftype2;
sr=Srate2;
else
fname=filename;
offSet=Be*bpsa+HDRSIZE;
n_samples=En-Be; %round(n_Secs*Srate)
ftp=ftype;
sr=Srate;
end
fp = fopen(fname,'r');
if fp <=0
disp('ERROR! File not found..')
return;
end
st = fseek(fp,offSet,'bof');
x=zeros(1,n_samples);
x = fread(fp,n_samples,ftp);
fclose(fp);
%---- Do some error checking on the signal level ---
meen=mean(x);
x= x - meen; %----------remove the DC bias---
nmF='Formant Tracks';
if isempty(ftrFig)
ftrFig = figure('Units', 'Pixels', 'Position', [LEFT BOTTOM WIDTH HEIGHT],...
'Resize','on','Name',nmF,'NumberTitle','Off');
%'Pointer','crosshair',...
else
figure(ftrFig);
set(ftrFig,'Name',nmF);
end
%----Set the LPC order depending on sampling rate ------
formants=zeros(3,nFrames);
elseif strcmp(action,'plot') %--- Plot Formant contour -----------
Et=nFrames*20;
xax=1:20:Et;
hold off
plot(xax,formants(1,:),'y',xax,formants(2,:),'r',xax,formants(3,:),'m');
ylabel('Freq. (Hz)');
xlabel('Time (msec)');
set(gca,'Xlim',[1 Et]);
%----------- Create the 'close' button'-----------------------
if clsedFrm ==1
xywh = get(ftrFig, 'Position');
% Buttons.
left = 6;
wide = 60;
top = xywh(4) - 10;
high = 22;
inc = high + 8;
uicontrol('Style', 'PushB', 'Callback', 'closem(''ftr'')', ...
'HorizontalAlign','center', 'String', 'Close', ...
'Position', [left top-high wide high]);
uimenu('Label','Save Formants','Callback','saveparm(''formnts'')');
clsedFrm=0;
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -