view arrows/dsp/aspectrum.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
% aspectrum - frequency spectrum arrow
%
% aspectrum ::
%    N:natural   ~'size of waveform blocks to expect'
%    options {
%       specfn :: ([[N,T]]->[[dftbins(N),T]])/ @powspec ~'function to compute spectra';
%       window :: (N:natural->[[N]])         / @hanning ~'function to compute window'
%    }
% -> arrow({[[N,T]]},{[[dftbins(N),T]]},empty).

function o=aspectrum(N,varargin)
	opts=options('specfn',@powspec,'window',@hanning,varargin{:});
	specfn=opts.specfn;
	w=spdiag(opts.window(N));
	o=arr(@fn);
	function y=fn(x)
		y=specfn(w*x);
	end
end