annotate 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 |
|
rev |
line source |
samer@0
|
1 % alpc - LPC arrow
|
samer@0
|
2 %
|
samer@0
|
3 % alpc ::
|
samer@0
|
4 % N:natural ~'size of waveform blocks to expect',
|
samer@0
|
5 % M:natural ~'order of LPC to do'
|
samer@0
|
6 % options {
|
samer@0
|
7 % specfn :: ([[N,T]]->[[dftbins(N),T]])/ @powspec ~'function to compute spectra';
|
samer@0
|
8 % window :: (N:natural->[[N]]) / @hanning ~'function to compute window'
|
samer@0
|
9 % }
|
samer@0
|
10 % -> arrow({[[N,1]]},{[[M,1]]},empty).
|
samer@0
|
11
|
samer@0
|
12 function o=alpc(N,M,varargin)
|
samer@37
|
13 opts=options('window',@hanning,'nargout',1,varargin{:});
|
samer@0
|
14 w=spdiag(opts.window(N));
|
samer@0
|
15 if opts.nargout<=1
|
samer@0
|
16 o=arr(@fn);
|
samer@0
|
17 else
|
samer@0
|
18 o=arr(@fn2);
|
samer@0
|
19 end
|
samer@0
|
20
|
samer@0
|
21 function y=fn(x)
|
samer@0
|
22 y=lpc(w*x,M);
|
samer@0
|
23 end
|
samer@0
|
24
|
samer@0
|
25 function [y,v]=fn2(x)
|
samer@0
|
26 [y,v]=lpc(w*x,M);
|
samer@0
|
27 end
|
samer@0
|
28 end
|