annotate arrows/dsp/amelspec.m @ 6:0ce3c2070089
Removed duplicate code and fixed doc in timed_action.
author |
samer |
date |
Mon, 14 Jan 2013 14:33:37 +0000 |
parents |
672052bd81f8 |
children |
beb8a3f4a345 |
rev |
line source |
samer@0
|
1 % amelspec - arrow from audio to log mel spectra
|
samer@0
|
2 %
|
samer@0
|
3 % amelspec ::
|
samer@0
|
4 % N:natural ~'size of FFT used to compute spectra',
|
samer@0
|
5 % M:natural ~'number of mel bands to compute'
|
samer@0
|
6 % nonneg ~'sampling frequency',
|
samer@0
|
7 % options {
|
samer@0
|
8 % windowfn :: N:natural->[[N]] / @hanning ~'window function';
|
samer@0
|
9 % lowf :: nonneg / 100 ~'filter bank low frequency in Hz'
|
samer@0
|
10 % }
|
samer@0
|
11 % -> arrow( {[[dftbins(N)]]}, {[[L]]}, empty).
|
samer@0
|
12 %
|
samer@0
|
13 % Uses antialiased triangular filterbank from lowf to fs/2.
|
samer@0
|
14
|
samer@0
|
15 function o=amelspec(N,M,fs,varargin)
|
samer@0
|
16 opts=prefs('windowfn',@hanning,'lowf',100,'floor',5e-9,varargin{:});
|
samer@0
|
17 melW = lin2mel(N,fs,[opts.lowf,fs/2],M);
|
samer@0
|
18 noise_floor=opts.floor;
|
samer@0
|
19 o = apowspec(opts.windowfn(N))*arr(@cc);
|
samer@0
|
20 function y=cc(x), y=log(melW*x+noise_floor); end
|
samer@0
|
21 end
|