From 4b1c288f87421b0e15908f5195284d47ebef7361 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Sat, 1 Apr 2017 21:50:32 +0200 Subject: [PATCH] update qm-vamp-plugins (git v1.7.1-10-g76bc879) --- libs/vamp-plugins/BarBeatTrack.cpp | 18 ++++---- libs/vamp-plugins/BeatTrack.cpp | 4 +- libs/vamp-plugins/ChromagramPlugin.cpp | 6 +-- libs/vamp-plugins/OnsetDetect.cpp | 14 +++---- libs/vamp-plugins/SimilarityPlugin.cpp | 22 +++++----- libs/vamp-plugins/SimilarityPlugin.h | 4 +- libs/vamp-plugins/TonalChangeDetect.cpp | 6 +-- libs/vamp-plugins/Transcription.cpp | 55 ++++++------------------- libs/vamp-plugins/Transcription.h | 10 ++--- 9 files changed, 55 insertions(+), 84 deletions(-) diff --git a/libs/vamp-plugins/BarBeatTrack.cpp b/libs/vamp-plugins/BarBeatTrack.cpp index d2f7d73c38..700d8cf381 100644 --- a/libs/vamp-plugins/BarBeatTrack.cpp +++ b/libs/vamp-plugins/BarBeatTrack.cpp @@ -434,11 +434,11 @@ BarBeatTracker::barBeatTrack() if (beat == m_bpb) beat = 0; } - for (size_t i = 0; i < beats.size(); ++i) { + for (int i = 0; i < int(beats.size()); ++i) { - size_t frame = beats[i] * m_d->dfConfig.stepSize; + size_t frame = size_t(beats[i]) * m_d->dfConfig.stepSize; - if (dbi < downbeats.size() && i == downbeats[dbi]) { + if (dbi < int(downbeats.size()) && i == downbeats[dbi]) { beat = 0; ++bar; ++dbi; @@ -452,19 +452,19 @@ BarBeatTracker::barBeatTrack() // 1 -> bars // 2 -> beat counter function - Feature feature; - feature.hasTimestamp = true; - feature.timestamp = m_d->origin + Vamp::RealTime::frame2RealTime - (frame, lrintf(m_inputSampleRate)); + Feature feature; + feature.hasTimestamp = true; + feature.timestamp = m_d->origin + Vamp::RealTime::frame2RealTime + (frame, lrintf(m_inputSampleRate)); sprintf(label, "%d", beat + 1); feature.label = label; - returnFeatures[0].push_back(feature); // labelled beats + returnFeatures[0].push_back(feature); // labelled beats feature.values.push_back(beat + 1); returnFeatures[2].push_back(feature); // beat function - if (i > 0 && i <= beatsd.size()) { + if (i > 0 && i <= int(beatsd.size())) { feature.values.clear(); feature.values.push_back(beatsd[i-1]); feature.label = ""; diff --git a/libs/vamp-plugins/BeatTrack.cpp b/libs/vamp-plugins/BeatTrack.cpp index 00ff40d6ee..6b854fe697 100644 --- a/libs/vamp-plugins/BeatTrack.cpp +++ b/libs/vamp-plugins/BeatTrack.cpp @@ -57,12 +57,12 @@ BeatTracker::BeatTracker(float inputSampleRate) : m_d(0), m_method(METHOD_NEW), m_dfType(DF_COMPLEXSD), - m_whiten(false), m_alpha(0.9), // MEPD new exposed parameter for beat tracker, default value = 0.9 (as old version) m_tightness(4.), m_inputtempo(120.), // MEPD new exposed parameter for beat tracker, default value = 120. (as old version) - m_constraintempo(false) // MEPD new exposed parameter for beat tracker, default value = false (as old version) + m_constraintempo(false), // MEPD new exposed parameter for beat tracker, default value = false (as old version) // calling the beat tracker with these default parameters will give the same output as the previous existing version + m_whiten(false) { } diff --git a/libs/vamp-plugins/ChromagramPlugin.cpp b/libs/vamp-plugins/ChromagramPlugin.cpp index be21961916..436ed0a482 100644 --- a/libs/vamp-plugins/ChromagramPlugin.cpp +++ b/libs/vamp-plugins/ChromagramPlugin.cpp @@ -330,7 +330,7 @@ ChromagramPlugin::getOutputDescriptors() const ChromagramPlugin::FeatureSet ChromagramPlugin::process(const float *const *inputBuffers, - Vamp::RealTime timestamp) + Vamp::RealTime ) { if (!m_chromagram) { cerr << "ERROR: ChromagramPlugin::process: " @@ -371,7 +371,7 @@ ChromagramPlugin::process(const float *const *inputBuffers, Feature feature; feature.hasTimestamp = false; - for (size_t i = 0; i < m_config.BPO; ++i) { + for (int i = 0; i < m_config.BPO; ++i) { double value = output[i]; /* if (printThis) { @@ -402,7 +402,7 @@ ChromagramPlugin::getRemainingFeatures() feature.hasTimestamp = true; feature.timestamp = Vamp::RealTime::zeroTime; - for (size_t i = 0; i < m_config.BPO; ++i) { + for (int i = 0; i < m_config.BPO; ++i) { double v = m_binsums[i]; if (m_count > 0) v /= m_count; feature.values.push_back(v); diff --git a/libs/vamp-plugins/OnsetDetect.cpp b/libs/vamp-plugins/OnsetDetect.cpp index 2a34791951..c2b6d68dbc 100644 --- a/libs/vamp-plugins/OnsetDetect.cpp +++ b/libs/vamp-plugins/OnsetDetect.cpp @@ -17,9 +17,9 @@ #endif #include "OnsetDetect.h" -#include "dsp/onsets/DetectionFunction.h" -#include "dsp/onsets/PeakPicking.h" -#include "dsp/tempotracking/TempoTrack.h" +#include +#include +#include using std::string; using std::vector; @@ -49,7 +49,7 @@ public: vector dfOutput; Vamp::RealTime origin; }; - + OnsetDetector::OnsetDetector(float inputSampleRate) : Vamp::Plugin(inputSampleRate), @@ -162,7 +162,7 @@ OnsetDetector::getParameter(std::string name) const } else if (name == "sensitivity") { return m_sensitivity; } else if (name == "whiten") { - return m_whiten ? 1.0 : 0.0; + return m_whiten ? 1.0 : 0.0; } return 0.0; } @@ -265,7 +265,7 @@ OnsetDetector::initialise(size_t channels, size_t stepSize, size_t blockSize) dfConfig.adaptiveWhitening = m_whiten; dfConfig.whiteningRelaxCoeff = -1; dfConfig.whiteningFloor = -1; - + m_d = new OnsetDetectorData(dfConfig); return true; } @@ -477,7 +477,7 @@ OnsetDetector::getRemainingFeatures() } for (unsigned int i = 0; i < ppParams.length; ++i) { - + Feature feature; // feature.hasTimestamp = false; feature.hasTimestamp = true; diff --git a/libs/vamp-plugins/SimilarityPlugin.cpp b/libs/vamp-plugins/SimilarityPlugin.cpp index 50e2b2f2a8..a3cc77e0c1 100644 --- a/libs/vamp-plugins/SimilarityPlugin.cpp +++ b/libs/vamp-plugins/SimilarityPlugin.cpp @@ -507,19 +507,19 @@ SimilarityPlugin::initialise(size_t channels, size_t stepSize, size_t blockSize) void SimilarityPlugin::reset() { - for (int i = 0; i < m_values.size(); ++i) { + for (int i = 0; i < int(m_values.size()); ++i) { m_values[i].clear(); } - for (int i = 0; i < m_rhythmValues.size(); ++i) { + for (int i = 0; i < int(m_rhythmValues.size()); ++i) { m_rhythmValues[i].clear(); } - for (int i = 0; i < m_lastNonEmptyFrame.size(); ++i) { + for (int i = 0; i < int(m_lastNonEmptyFrame.size()); ++i) { m_lastNonEmptyFrame[i] = -1; } - for (int i = 0; i < m_emptyFrameCount.size(); ++i) { + for (int i = 0; i < int(m_emptyFrameCount.size()); ++i) { m_emptyFrameCount[i] = 0; } @@ -544,7 +544,7 @@ SimilarityPlugin::process(const float *const *inputBuffers, Vamp::RealTime /* ti bool someRhythmFrameNeeded = false; - for (size_t c = 0; c < m_channels; ++c) { + for (int c = 0; c < m_channels; ++c) { bool empty = true; @@ -557,7 +557,7 @@ SimilarityPlugin::process(const float *const *inputBuffers, Vamp::RealTime /* ti if (empty) { if (needRhythm() && ((m_frameNo % 2) == 0)) { for (int i = 0; i < m_fftSize / m_rhythmClipFrameSize; ++i) { - if (m_rhythmValues[c].size() < m_rhythmClipFrames) { + if (int(m_rhythmValues[c].size()) < m_rhythmClipFrames) { FeatureColumn mf(m_rhythmColumnSize); for (int i = 0; i < m_rhythmColumnSize; ++i) { mf[i] = 0.0; @@ -609,7 +609,7 @@ SimilarityPlugin::process(const float *const *inputBuffers, Vamp::RealTime /* ti bool needRhythmFrame = true; - if (m_rhythmValues[c].size() >= m_rhythmClipFrames) { + if (int(m_rhythmValues[c].size()) >= m_rhythmClipFrames) { needRhythmFrame = false; @@ -681,7 +681,9 @@ SimilarityPlugin::calculateTimbral(FeatureSet &returnFeatures) int sz = m_lastNonEmptyFrame[i] - m_emptyFrameCount[i]; if (sz < 0) sz = 0; - if (sz >= m_values[i].size()) sz = m_values[i].size()-1; + if (sz >= int(m_values[i].size())) { + sz = int(m_values[i].size())-1; + } count = 0; for (int k = 0; k < sz; ++k) { @@ -803,7 +805,7 @@ SimilarityPlugin::calculateRhythmic(FeatureSet &returnFeatures) FeatureMatrixSet bsinput(m_channels); for (int i = 0; i < m_channels; ++i) { - for (int j = 0; j < m_rhythmValues[i].size(); ++j) { + for (int j = 0; j < int(m_rhythmValues[i].size()); ++j) { bsinput[i].push_back(m_rhythmValues[i][j]); } } @@ -834,7 +836,7 @@ SimilarityPlugin::calculateRhythmic(FeatureSet &returnFeatures) feature.label = labelBuffer; feature.values.clear(); - for (int j = 0; j < bs[i].size(); ++j) { + for (int j = 0; j < int(bs[i].size()); ++j) { feature.values.push_back(bs[i][j]); } diff --git a/libs/vamp-plugins/SimilarityPlugin.h b/libs/vamp-plugins/SimilarityPlugin.h index 1f30aabd21..85fbc7ddf3 100644 --- a/libs/vamp-plugins/SimilarityPlugin.h +++ b/libs/vamp-plugins/SimilarityPlugin.h @@ -82,8 +82,8 @@ protected: int m_rhythmClipFrameSize; int m_rhythmClipFrames; int m_rhythmColumnSize; - mutable size_t m_blockSize; // before decimation - size_t m_fftSize; // after decimation + mutable int m_blockSize; // before decimation + int m_fftSize; // after decimation int m_channels; int m_processRate; int m_frameNo; diff --git a/libs/vamp-plugins/TonalChangeDetect.cpp b/libs/vamp-plugins/TonalChangeDetect.cpp index 7b0cd230d1..d391b44052 100644 --- a/libs/vamp-plugins/TonalChangeDetect.cpp +++ b/libs/vamp-plugins/TonalChangeDetect.cpp @@ -407,13 +407,11 @@ TonalChangeDetect::FeatureSet TonalChangeDetect::getRemainingFeatures() ChangeDetectionFunction df(dfc); ChangeDistance d = df.process(m_TCSGram); - - - for (int i = 0; i < d.size(); i++) + for (int i = 0; i < int(d.size()); i++) { double dCurrent = d[i]; double dPrevious = d[i > 0 ? i - 1 : i]; - double dNext = d[i < d.size()-1 ? i + 1 : i]; + double dNext = d[i < int(d.size())-1 ? i + 1 : i]; Feature feature; feature.label = ""; diff --git a/libs/vamp-plugins/Transcription.cpp b/libs/vamp-plugins/Transcription.cpp index 25c8099336..fac024e4d1 100644 --- a/libs/vamp-plugins/Transcription.cpp +++ b/libs/vamp-plugins/Transcription.cpp @@ -24,20 +24,6 @@ using std::vector; using std::cerr; using std::endl; -const double CNum[8] = { - 3.025328153863e-005,0.0002117729707704,0.0006353189123113, 0.001058864853852, - 0.001058864853852,0.0006353189123113,0.0002117729707704,3.025328153863e-005 -}; - -const double CDen[8] = { - 1, -4.647847898799, 9.540784706769, -11.14354542746, - 7.967285533211, -3.477244449085, 0.8559660579522, -0.09152610255505 -}; - -const int A[10] = {0, 120, 190, 240, 279, 310, 337, 360, 380, 399}; - - - const double EualCurve960[960] = { 83.750025,83.532690,83.315770,83.099260,82.883159,82.667463,82.452170,82.237276,82.022779,81.808675, 81.594963,81.381639,81.168699,80.956142,80.743964,80.532163,80.320735,80.109677,79.898987,79.688663,79.478700,79.269096,79.059848,78.850953, @@ -351,10 +337,10 @@ Transcription::process(const float *const *inputBuffers, if (m_Excess) return FeatureSet(); - for (size_t i = 0; i < m_blockSize;i++) { + for (int i = 0; i < m_blockSize;i++) { if (m_SampleN >= m_AllocN) { - size_t newsize = m_AllocN * 2; + int newsize = m_AllocN * 2; if (newsize < 10000) newsize = 10000; double *newbuf = (double *)realloc(m_SoundIn, newsize * sizeof(double)); if (!newbuf) { @@ -382,10 +368,9 @@ Transcription::getRemainingFeatures() double *hello1; double *hello2; int Msec; - size_t i; - size_t j; - size_t n; - size_t count; + int i; + int j; + int n; Msec=(int)(100*m_SampleN/m_inputSampleRate); @@ -471,9 +456,7 @@ Transcription::getRemainingFeatures() double starts[88]; for (n = 0; n < 88; ++n) starts[n] = -1.0; - int nn; for (j = 0; j 34)&&(abs(A5[j]-337.0-A5[j-34])<3.0)&&(D[j]>0)&&(D[j-34]>0)) + if ((j>34)&&(fabs(A5[j]-337.0-A5[j-34])<3.0)&&(D[j]>0)&&(D[j-34]>0)) { D[j]=0; D2[j]=0; diff --git a/libs/vamp-plugins/Transcription.h b/libs/vamp-plugins/Transcription.h index 3796cb31b4..419009662d 100644 --- a/libs/vamp-plugins/Transcription.h +++ b/libs/vamp-plugins/Transcription.h @@ -1,7 +1,7 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ #ifndef _TRANSCRIPTION_PLUGIN_H_ -#define _TRSNSCRIPTION_PLUGIN_H_ +#define _TRANSCRIPTION_PLUGIN_H_ #include @@ -33,11 +33,11 @@ public: FeatureSet getRemainingFeatures(); protected: - size_t m_stepSize; - size_t m_blockSize; + int m_stepSize; + int m_blockSize; double * m_SoundIn; - size_t m_SampleN; - size_t m_AllocN; + int m_SampleN; + int m_AllocN; bool m_Excess; Vamp::RealTime m_Base; /*