# HG changeset patch # User Chris Cannam # Date 1412004136 -3600 # Node ID 8c151a9ca20244c421aec7cdaa519e4f8be24538 # Parent cb79f27f0748e575d9a5cee26b3ccc79cfd9b101 Tidy diff -r cb79f27f0748 -r 8c151a9ca202 TempogramPlugin.cpp --- a/TempogramPlugin.cpp Mon Sep 29 16:20:16 2014 +0100 +++ b/TempogramPlugin.cpp Mon Sep 29 16:22:16 2014 +0100 @@ -463,7 +463,7 @@ //initialise novelty curve processor int numberOfBlocks = m_spectrogram.size(); - //cerr << numberOfBlocks << endl; + NoveltyCurveProcessor nc(m_inputSampleRate, m_inputBlockSize, m_noveltyCurveCompressionConstant); vector noveltyCurve = nc.spectrogramToNoveltyCurve(m_spectrogram); //calculate novelty curvefrom magnitude data @@ -506,13 +506,9 @@ for (int block = 0; block < tempogramLength; block++){ Feature tempogramACTFeature; -// cerr << "block = " << block << ", window length = " << m_tempogramWindowLength << ", max lag = " << m_tempogramMaxLag << ", min lag = " << m_tempogramMinLag << endl; - for(int k = m_tempogramMaxLag; k >= (int)m_tempogramMinLag; k--){ -// cerr << "(" << block << "," << k << ") "; tempogramACTFeature.values.push_back(tempogramACT[block][k]); } -// cerr << endl; tempogramACTFeature.hasTimestamp = false; featureSet[2].push_back(tempogramACTFeature); } @@ -528,18 +524,7 @@ float sum = 0; for (int j = 0; j < m_cyclicTempogramNumberOfOctaves; j++){ - - if (block >= tempogramDFT.size()) { - cerr << "ERROR: at block = " << block << ", i = " << i << ", j = " << j << ": block " << block << " >= tempogramDFT.size() " << tempogramDFT.size() << endl; - } else if (j > logBins.size()) { - cerr << "ERROR: at block = " << block << ", i = " << i << ", j = " << j << ": j " << j << " >= logBins.size() " << logBins.size() << endl; - } else if (i > logBins[j].size()) { - cerr << "ERROR: at block = " << block << ", i = " << i << ", j = " << j << ": i " << i << " >= logBins[j].size() " << logBins[j].size() << endl; - } else if (logBins[j][i] >= tempogramDFT[block].size()) { - cerr << "ERROR: at block = " << block << ", i = " << i << ", j = " << j << ": logBins[j][i] " << logBins[j][i] << " >= tempogramDFT[block].size() " << tempogramDFT[block].size() << endl; - } else { - sum += tempogramDFT[block][logBins[j][i]]; - } + sum += tempogramDFT[block][logBins[j][i]]; } cyclicTempogramFeature.values.push_back(sum/m_cyclicTempogramNumberOfOctaves); assert(!isnan(cyclicTempogramFeature.values.back())); @@ -556,23 +541,14 @@ { vector< vector > logBins; - cerr << "calculateTempogramNearestNeighbourLogBins: octaves = " - << m_cyclicTempogramNumberOfOctaves << endl; - for (int octave = 0; octave < (int)m_cyclicTempogramNumberOfOctaves; octave++){ vector 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; @@ -659,11 +635,6 @@ 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)); if (m_cyclicTempogramNumberOfOctaves < 1) {