📄 fillslot.m
字号:
function [slots]=fillslot4a(pks,init_f)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% jmw
%
% 12/01/93
% function to fill (formant) slots with
% peaks.
% STEP 2 of the McCandless Algorithm
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
echo off
EST1 = 320; % values from McCandless paper for initial estimates
EST2 = 1440; % FOR MALE VOICES !
EST3 = 2760;
EST4 = 3200;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
if (nargin ==1)
EST1 = 320; % values from McCandless paper for initial estimates
EST2 = 1440;
EST3 = 2760;
EST4 = 3200;
else
EST1 = init_f(1);
EST2 = init_f(2);
EST3 = init_f(3);
EST4 = init_f(4);
end;
slots = [ 0 0 0 0 ]; % allocate mem
% do f1
d = abs( pks - EST1);
[diffs, index] = sort(d);
if (pks(index(1)) ~= 0)
slots(1) = pks(index(1));
else
slots(1) = pks(index(2));
end;
% do f2
d = abs( pks - EST2);
[diffs, index] = sort(d);
if (pks(index(1)) ~= 0)
slots(2) = pks(index(1));
else
slots(2) = pks(index(2));
end;
% do f3
d = abs( pks - EST3);
[diffs, index] = sort(d);
if (pks(index(1)) ~= 0)
slots(3) = pks(index(1));
else
slots(3) = pks(index(2));
end;
% do f4
d = abs( pks - EST4);
[diffs, index] = sort(d);
if (pks(index(1)) ~= 0)
slots(4) = pks(index(1));
else
slots(4) = pks(index(2));
end;
return;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -