annotate dsp/spectraldata.m @ 36:9e7be347b3a0
Renamed sequence classes to avoid clashes with seq methods;
Fixed default slicing dimension while retaining behaviour of window.m;
Updated use of sequences in dsp/synth.
author |
samer |
date |
Thu, 24 Jan 2013 14:51:23 +0000 |
parents |
c3b0cd708782 |
children |
|
rev |
line source |
samer@32
|
1 function a=spectraldata(source,specfn,windowfn)
|
samer@32
|
2 % SPECTRALDATA - Spectral data from buffered frames
|
samer@32
|
3 %
|
samer@32
|
4 % spectraldata :: (
|
samer@32
|
5 % source: seq[n,l], ~ source data
|
samer@32
|
6 % specfn: [n,l]->[m,l], ~ compute spectrum from frames
|
samer@32
|
7 % windowfn: (n:natural->[n]) ~ function to compute window, eg hanning
|
samer@32
|
8 % ) -> seq[m,l]
|
samer@32
|
9
|
samer@32
|
10 H=spdiag(feval(windowfn,size(source,1)));
|
samer@32
|
11 a=map(@(x)specfn(H*x),source);
|
samer@32
|
12 %a=fnseq(fn,source,'charfn',@charfn);
|
samer@32
|
13
|
samer@32
|
14 % function s=charfn(o)
|
samer@32
|
15 % s=sprintf('%s >> %s/%s',char(source(o)),tostring(specfn),tostring(windowfn));
|
samer@32
|
16 % end
|
samer@32
|
17 end
|
samer@32
|
18
|