annotate 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
rev   line source
samer@0 1 % aspectrum - frequency spectrum arrow
samer@0 2 %
samer@0 3 % aspectrum ::
samer@0 4 % N:natural ~'size of waveform blocks to expect'
samer@0 5 % options {
samer@0 6 % specfn :: ([[N,T]]->[[dftbins(N),T]])/ @powspec ~'function to compute spectra';
samer@0 7 % window :: (N:natural->[[N]]) / @hanning ~'function to compute window'
samer@0 8 % }
samer@0 9 % -> arrow({[[N,T]]},{[[dftbins(N),T]]},empty).
samer@0 10
samer@0 11 function o=aspectrum(N,varargin)
samer@37 12 opts=options('specfn',@powspec,'window',@hanning,varargin{:});
samer@0 13 specfn=opts.specfn;
samer@0 14 w=spdiag(opts.window(N));
samer@0 15 o=arr(@fn);
samer@0 16 function y=fn(x)
samer@0 17 y=specfn(w*x);
samer@0 18 end
samer@0 19 end