Mercurial > hg > qm-dsp
diff dsp/chromagram/ConstantQ.cpp @ 245:cdfd0948a852
* First cut at properly integrating the segmenter and making it work right
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Wed, 09 Jan 2008 16:50:04 +0000 |
parents | b7f01ab7045e |
children | 2b74bd60c61f |
line wrap: on
line diff
--- a/dsp/chromagram/ConstantQ.cpp Wed Jan 09 10:48:08 2008 +0000 +++ b/dsp/chromagram/ConstantQ.cpp Wed Jan 09 16:50:04 2008 +0000 @@ -10,6 +10,8 @@ #include "ConstantQ.h" #include "dsp/transforms/FFT.h" +#include <iostream> + //--------------------------------------------------------------------------- // nextpow2 returns the smallest integer n such that 2^n >= x. static double nextpow2(double x) { @@ -168,11 +170,15 @@ m_dQ = 1/(pow(2,(1/(double)m_BPO))-1); // Work out Q value for Filter bank m_uK = (unsigned int) ceil(m_BPO * log(m_FMax/m_FMin)/log(2.0)); // No. of constant Q bins + std::cerr << "ConstantQ::initialise: rate = " << m_FS << ", fmin = " << m_FMin << ", fmax = " << m_FMax << ", bpo = " << m_BPO << ", K = " << m_uK << ", Q = " << m_dQ << std::endl; + // work out length of fft required for this constant Q Filter bank m_FFTLength = (int) pow(2, nextpow2(ceil( m_dQ*m_FS/m_FMin ))); m_hop = m_FFTLength/8; // <------ hop size is window length divided by 32 + std::cerr << "ConstantQ::initialise: -> fft length = " << m_FFTLength << ", hop = " << m_hop << std::endl; + // allocate memory for cqdata m_CQdata = new double [2*m_uK]; }