Mercurial > hg > qm-dsp
comparison dsp/chromagram/Chromagram.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 | 1db23b9a8da4 |
children | fdaa63607c15 |
comparison
equal
deleted
inserted
replaced
467:1db23b9a8da4 | 468:a72d98f8baa3 |
---|---|
31 m_FMin = Config.min; // min freq | 31 m_FMin = Config.min; // min freq |
32 m_FMax = Config.max; // max freq | 32 m_FMax = Config.max; // max freq |
33 m_BPO = Config.BPO; // bins per octave | 33 m_BPO = Config.BPO; // bins per octave |
34 m_normalise = Config.normalise; // if frame normalisation is required | 34 m_normalise = Config.normalise; // if frame normalisation is required |
35 | 35 |
36 // No. of constant Q bins, extended to a full octave | 36 // Extend range to a full octave |
37 m_uK = m_BPO * int(ceil(log(m_FMax/m_FMin)/log(2.0))); | 37 double octaves = log(m_FMax / m_FMin) / log(2.0); |
38 m_FMax = m_FMin * pow(2.0, ceil(octaves)); | |
38 | 39 |
39 // Create array for chroma result | 40 // Create array for chroma result |
40 m_chromadata = new double[ m_BPO ]; | 41 m_chromadata = new double[ m_BPO ]; |
41 | 42 |
42 // Create Config Structure for ConstantQ operator | 43 // Create Config Structure for ConstantQ operator |
50 ConstantQConfig.BPO = m_BPO; | 51 ConstantQConfig.BPO = m_BPO; |
51 ConstantQConfig.CQThresh = Config.CQThresh; | 52 ConstantQConfig.CQThresh = Config.CQThresh; |
52 | 53 |
53 // Initialise ConstantQ operator | 54 // Initialise ConstantQ operator |
54 m_ConstantQ = new ConstantQ( ConstantQConfig ); | 55 m_ConstantQ = new ConstantQ( ConstantQConfig ); |
56 | |
57 // No. of constant Q bins | |
58 m_uK = m_ConstantQ->getK(); | |
55 | 59 |
56 // Initialise working arrays | 60 // Initialise working arrays |
57 m_frameSize = m_ConstantQ->getfftlength(); | 61 m_frameSize = m_ConstantQ->getfftlength(); |
58 m_hopSize = m_ConstantQ->gethop(); | 62 m_hopSize = m_ConstantQ->gethop(); |
59 | 63 |