# HG changeset patch # User Chris Cannam # Date 1559135323 -3600 # Node ID 46375e6d1b542572eacfdadcd804e1327274a650 # Parent 50a97c8d52ed570883c60eae18c67ab37bb048ce Apply fix from daschuer/mixxx:b9c6bde3 Extend the number of Q bins always to a full octave diff -r 50a97c8d52ed -r 46375e6d1b54 dsp/chromagram/Chromagram.cpp --- a/dsp/chromagram/Chromagram.cpp Wed May 29 13:55:26 2019 +0100 +++ b/dsp/chromagram/Chromagram.cpp Wed May 29 14:08:43 2019 +0100 @@ -33,8 +33,8 @@ m_BPO = Config.BPO; // bins per octave m_normalise = Config.normalise; // if frame normalisation is required - // No. of constant Q bins - m_uK = (int) ceil( m_BPO * log(m_FMax/m_FMin)/log(2.0)); + // No. of constant Q bins, extended to a full octave + m_uK = m_BPO * int(ceil(log(m_FMax/m_FMin)/log(2.0))); // Create array for chroma result m_chromadata = new double[ m_BPO ]; @@ -159,8 +159,8 @@ m_ConstantQ->process( real, imag, m_CQRe, m_CQIm ); // add each octave of cq data into Chromagram - const int octaves = (int)floor(double( m_uK/m_BPO))-1; - for (int octave = 0; octave <= octaves; octave++) + const int octaves = m_uK / m_BPO; + for (int octave = 0; octave < octaves; octave++) { int firstBin = octave*m_BPO; for (int i = 0; i < m_BPO; i++) diff -r 50a97c8d52ed -r 46375e6d1b54 dsp/chromagram/ConstantQ.cpp --- a/dsp/chromagram/ConstantQ.cpp Wed May 29 13:55:26 2019 +0100 +++ b/dsp/chromagram/ConstantQ.cpp Wed May 29 14:08:43 2019 +0100 @@ -293,7 +293,7 @@ m_CQThresh = Config.CQThresh;// ConstantQ threshold for kernel generation 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 + m_uK = m_BPO * int(ceil(log(m_FMax/m_FMin)/log(2.0))); // No. of constant Q bins, extended to a full octave // std::cerr << "ConstantQ::initialise: rate = " << m_FS << ", fmin = " << m_FMin << ", fmax = " << m_FMax << ", bpo = " << m_BPO << ", K = " << m_uK << ", Q = " << m_dQ << std::endl;