samer@32
|
1 function [X, times, edges] = constq(range,res,hop,window,fs,signal)
|
samer@32
|
2 % as_constq - Constant Q spectrogram.
|
samer@32
|
3 %
|
samer@32
|
4 % as_constq ::
|
samer@32
|
5 % [[2]] ~ 'frequency range as a two-element array, [low high]',
|
samer@32
|
6 % real ~ 'resolution in octaves',
|
samer@32
|
7 % natural | [[2]] ~ 'hop size, either in samples, or as a rational',
|
samer@32
|
8 % natural | [[2]] ~ 'window size, either in samples, or as a rational',
|
samer@32
|
9 % real ~ 'sampling frequency',
|
samer@32
|
10 % [[T]] ~ 'signal of length T'
|
samer@32
|
11 % ->
|
samer@32
|
12 % [[L,M]] ~ 'L-by-M array containing L-band spectral envelopes',
|
samer@32
|
13 % [[1,M]] ~ 'array of nominal sampling time for each frame',
|
samer@32
|
14 % [[L-1]] ~ 'array of L-1 band edge frequencies'.
|
samer@32
|
15
|
samer@32
|
16 parms=h_fparms(fs,hop,window);
|
samer@33
|
17 [S,times]=powspec(parms,signal);
|
samer@32
|
18
|
samer@32
|
19 % 1000 Hz is the reference frequency for edge quantisation
|
samer@32
|
20 nedges=cqedges(fs,range,res,1000);
|
samer@32
|
21 X=specbasis(parms.FFTsize*nedges,size(S,1))*S;
|
samer@32
|
22 edges=fs*nedges;
|
samer@32
|
23
|