Mercurial > hg > qm-dsp
comparison dsp/chromagram/ConstantQ.cpp @ 468:a72d98f8baa3
Revise mechanism for extending chromagram to round number of octaves -
do it only in the chromagram itself, so that we can still create deviant
constant-Q spectrograms if desired
author | Chris Cannam <cannam@all-day-breakfast.com> |
---|---|
date | Thu, 30 May 2019 11:35:35 +0100 |
parents | 46375e6d1b54 |
children | 8d84e5d16314 |
comparison
equal
deleted
inserted
replaced
467:1db23b9a8da4 | 468:a72d98f8baa3 |
---|---|
291 m_FMax = Config.max; // max freq | 291 m_FMax = Config.max; // max freq |
292 m_BPO = Config.BPO; // bins per octave | 292 m_BPO = Config.BPO; // bins per octave |
293 m_CQThresh = Config.CQThresh;// ConstantQ threshold for kernel generation | 293 m_CQThresh = Config.CQThresh;// ConstantQ threshold for kernel generation |
294 | 294 |
295 m_dQ = 1/(pow(2,(1/(double)m_BPO))-1); // Work out Q value for Filter bank | 295 m_dQ = 1/(pow(2,(1/(double)m_BPO))-1); // Work out Q value for Filter bank |
296 m_uK = m_BPO * int(ceil(log(m_FMax/m_FMin)/log(2.0))); // No. of constant Q bins, extended to a full octave | 296 m_uK = (unsigned int) ceil(m_BPO * log(m_FMax/m_FMin)/log(2.0)); // No. of constant Q bins |
297 | 297 |
298 // std::cerr << "ConstantQ::initialise: rate = " << m_FS << ", fmin = " << m_FMin << ", fmax = " << m_FMax << ", bpo = " << m_BPO << ", K = " << m_uK << ", Q = " << m_dQ << std::endl; | 298 // std::cerr << "ConstantQ::initialise: rate = " << m_FS << ", fmin = " << m_FMin << ", fmax = " << m_FMax << ", bpo = " << m_BPO << ", K = " << m_uK << ", Q = " << m_dQ << std::endl; |
299 | 299 |
300 // work out length of fft required for this constant Q Filter bank | 300 // work out length of fft required for this constant Q Filter bank |
301 m_FFTLength = (int) pow(2, nextpow2(ceil( m_dQ*m_FS/m_FMin ))); | 301 m_FFTLength = (int) pow(2, nextpow2(ceil( m_dQ*m_FS/m_FMin ))); |
302 | 302 |
303 m_hop = m_FFTLength/8; // <------ hop size is window length divided by 32 | 303 m_hop = m_FFTLength/8; |
304 | 304 |
305 // std::cerr << "ConstantQ::initialise: -> fft length = " << m_FFTLength << ", hop = " << m_hop << std::endl; | 305 // std::cerr << "ConstantQ::initialise: -> fft length = " << m_FFTLength << ", hop = " << m_hop << std::endl; |
306 | 306 |
307 // allocate memory for cqdata | 307 // allocate memory for cqdata |
308 m_CQdata = new double [2*m_uK]; | 308 m_CQdata = new double [2*m_uK]; |