view arrows/dsp/alpc.m @ 61:eff6bddf82e3 tip

Finally implemented perceptual brightness thing.
author samer
date Sun, 11 Oct 2015 10:20:42 +0100
parents beb8a3f4a345
children
line wrap: on
line source
% alpc - LPC arrow
%
% alpc ::
%    N:natural   ~'size of waveform blocks to expect',
%    M:natural   ~'order of LPC to do'
%    options {
%       specfn :: ([[N,T]]->[[dftbins(N),T]])/ @powspec ~'function to compute spectra';
%       window :: (N:natural->[[N]])         / @hanning ~'function to compute window'
%    }
% -> arrow({[[N,1]]},{[[M,1]]},empty).

function o=alpc(N,M,varargin)
	opts=options('window',@hanning,'nargout',1,varargin{:});
	w=spdiag(opts.window(N));
	if opts.nargout<=1
		o=arr(@fn);
	else
		o=arr(@fn2);
	end

	function y=fn(x)
		y=lpc(w*x,M);
	end

	function [y,v]=fn2(x)
		[y,v]=lpc(w*x,M);
	end
end