Mercurial > hg > vamp-tempogram
changeset 47:cb79f27f0748
Clamp cyclic tempogram min and max BPM to the BPM equivalents of the actual underlying min and max tempogram bins, rather than the "input" min and max BPM (fixed root cause of #1054)
author | Chris Cannam |
---|---|
date | Mon, 29 Sep 2014 16:20:16 +0100 |
parents | eafb3a7f80fb |
children | 8c151a9ca202 |
files | TempogramPlugin.cpp |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/TempogramPlugin.cpp Mon Sep 29 16:19:12 2014 +0100 +++ b/TempogramPlugin.cpp Mon Sep 29 16:20:16 2014 +0100 @@ -556,15 +556,23 @@ { vector< vector<unsigned int> > logBins; + cerr << "calculateTempogramNearestNeighbourLogBins: octaves = " + << m_cyclicTempogramNumberOfOctaves << endl; + for (int octave = 0; octave < (int)m_cyclicTempogramNumberOfOctaves; octave++){ vector<unsigned int> octaveBins; - + + cerr << "octave " << octave << ":" << endl; + for (int bin = 0; bin < (int)m_cyclicTempogramOctaveDivider; bin++){ float bpm = m_cyclicTempogramMinBPM*pow(2.0f, octave+(float)bin/m_cyclicTempogramOctaveDivider); octaveBins.push_back(bpmToBin(bpm)); + cerr << bpmToBin(bpm) << " "; //cout << octaveBins.back() << endl; } + cerr << endl; logBins.push_back(octaveBins); + } return logBins; @@ -648,8 +656,13 @@ return false; } - m_cyclicTempogramMinBPM = m_tempogramMinBPM; - float cyclicTempogramMaxBPM = m_tempogramMaxBPM; + m_cyclicTempogramMinBPM = max(binToBPM(m_tempogramMinBin), m_tempogramMinBPM); + float cyclicTempogramMaxBPM = min(binToBPM(m_tempogramMaxBin), m_tempogramMaxBPM); + + cerr << "tempogram min bpm = " << m_tempogramMinBPM << ", cyclic min = " + << m_cyclicTempogramMinBPM << endl; + cerr << "tempogram max bpm = " << m_tempogramMaxBPM << ", cyclic max = " + << cyclicTempogramMaxBPM << endl; m_cyclicTempogramNumberOfOctaves = floor(log2(cyclicTempogramMaxBPM/m_cyclicTempogramMinBPM));