diff dsp/constq.m @ 32:c3b0cd708782

Imported core dsp tools.
author samer
date Sun, 20 Jan 2013 13:48:47 +0000
parents
children 5b7d90b6393a
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dsp/constq.m	Sun Jan 20 13:48:47 2013 +0000
@@ -0,0 +1,23 @@
+function [X, times, edges] = constq(range,res,hop,window,fs,signal)
+% as_constq - Constant Q spectrogram.
+%
+% as_constq ::
+%    [[2]]           ~ 'frequency range as a two-element array, [low high]',
+%    real            ~ 'resolution in octaves',
+%    natural | [[2]]	~ 'hop size, either in samples, or as a rational',
+%    natural | [[2]]	~ 'window size, either in samples, or as a rational',
+%    real            ~ 'sampling frequency',
+%    [[T]]           ~ 'signal of length T'
+% ->
+%    [[L,M]]         ~ 'L-by-M array containing L-band spectral envelopes',
+%    [[1,M]]         ~ 'array of nominal sampling time for each frame',
+%    [[L-1]]         ~ 'array of L-1 band edge frequencies'.
+
+parms=h_fparms(fs,hop,window);
+[S,times]=h_powspec(parms,signal);
+
+% 1000 Hz is the reference frequency for edge quantisation
+nedges=cqedges(fs,range,res,1000);
+X=specbasis(parms.FFTsize*nedges,size(S,1))*S;
+edges=fs*nedges;
+