ADAPTLOOP - Adaptation loops.

Program code:

function inoutsig = adaptloop(inoutsig,fs,limit,minlvl,tau);

% Copyright (c) 1999 - 2004 Stephan Ewert. All rights reserved.

%   AUTHOR : Stephan Ewert, Morten L. Jepsen, Peter L. Soendergaard

% ------ Checking of input parameters and default parameters ---------

error(nargchk(2,5,nargin));

% Default parameters for tau measured in seconds.
if nargin<5
  tau=[0.005 0.050 0.129 0.253 0.500];
else
  if ~isnumeric(tau) || ~isvector(tau) || tau<=0
    error('%s: tau must be a vector with positive values.',upper(mfilename));
  end;
end;

if nargin<4
  minlvl =1e-5;
else
  if ~isnumeric(minlvl) || ~isscalar(minlvl) || minlvl<=0
    error('%s: minlvl must be a positive scalar.',upper(mfilename));
  end;
end;

if nargin<3
  limit = 10;
else
  if ~isnumeric(limit) || ~isscalar(limit)
    error('%s: "limit" must be a scalar.',upper(mfilename));
  end;
end;

% -------- Computation ------------------

inoutsig=comp_adaptloop(inoutsig,fs,limit,minlvl);