Mercurial > hg > vamp-tempogram
changeset 23:7d36c742a183
* Tidying in TempogramPlugin.cpp
author | Carl Bussey <c.bussey@se10.qmul.ac.uk> |
---|---|
date | Tue, 19 Aug 2014 17:40:10 +0100 |
parents | 99380ba63be6 |
children | 957b83524c06 |
files | NoveltyCurveProcessor.cpp TempogramPlugin.cpp |
diffstat | 2 files changed, 9 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/NoveltyCurveProcessor.cpp Tue Aug 19 16:52:19 2014 +0100 +++ b/NoveltyCurveProcessor.cpp Tue Aug 19 17:40:10 2014 +0100 @@ -117,7 +117,7 @@ { int numberOfBlocks = spectrogramTransposed[0].size(); - for (int block = 0; block < (int)numberOfBlocks; block++){ + for (int block = 0; block < numberOfBlocks; block++){ for (int k = 0; k < (int)m_blockSize; k++){ if (spectrogramTransposed[k][block] < 0.0) spectrogramTransposed[k][block] = 0.0; }
--- a/TempogramPlugin.cpp Tue Aug 19 16:52:19 2014 +0100 +++ b/TempogramPlugin.cpp Tue Aug 19 17:40:10 2014 +0100 @@ -402,25 +402,20 @@ TempogramPlugin::FeatureSet TempogramPlugin::process(const float *const *inputBuffers, Vamp::RealTime timestamp) { - //cerr << "Here" << endl; - - size_t n = m_inputBlockSize/2 + 1; - FeatureSet featureSet; - Feature feature; - + int n = m_inputBlockSize/2 + 1; const float *in = inputBuffers[0]; //calculate magnitude of FrequencyDomain input vector<float> fftCoefficients; - for (int i = 0; i < (int)n; i++){ + for (int i = 0; i < n; i++){ float magnitude = sqrt(in[2*i] * in[2*i] + in[2*i + 1] * in[2*i + 1]); magnitude = magnitude > m_noveltyCurveMinDB ? magnitude : m_noveltyCurveMinDB; fftCoefficients.push_back(magnitude); } m_spectrogram.push_back(fftCoefficients); - return featureSet; + return FeatureSet(); } TempogramPlugin::FeatureSet @@ -435,14 +430,14 @@ FeatureSet featureSet; //initialise novelty curve processor - size_t numberOfBlocks = m_spectrogram.size(); + int numberOfBlocks = m_spectrogram.size(); //cerr << numberOfBlocks << endl; NoveltyCurveProcessor nc(m_inputSampleRate, m_inputBlockSize, m_noveltyCurveCompressionConstant); vector<float> noveltyCurve = nc.spectrogramToNoveltyCurve(m_spectrogram); //calculate novelty curvefrom magnitude data //if(noveltyCurve.size() > 50) for (int i = 0; i < 50; i++) cerr << noveltyCurve[i] << endl; //push novelty curve data to featureset 1 and set timestamps - for (int i = 0; i < (int)numberOfBlocks; i++){ + for (int i = 0; i < numberOfBlocks; i++){ Feature noveltyCurveFeature; noveltyCurveFeature.values.push_back(noveltyCurve[i]); noveltyCurveFeature.hasTimestamp = false; @@ -482,10 +477,10 @@ for (int block = 0; block < tempogramLength; block++){ Feature cyclicTempogramFeature; - for (int i = 0; i < (int)m_cyclicTempogramOctaveDivider; i++){ + for (int i = 0; i < m_cyclicTempogramOctaveDivider; i++){ float sum = 0; - for (int j = 0; j < (int)m_cyclicTempogramNumberOfOctaves; j++){ + for (int j = 0; j < m_cyclicTempogramNumberOfOctaves; j++){ sum += tempogram[block][logBins[j][i]]; } cyclicTempogramFeature.values.push_back(sum/m_cyclicTempogramNumberOfOctaves); @@ -508,8 +503,8 @@ 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)); + //cout << octaveBins.back() << endl; } logBins.push_back(octaveBins); }