summaryrefslogtreecommitdiff
path: root/libs/vamp-plugins
diff options
context:
space:
mode:
authorRobin Gareus <robin@gareus.org>2016-10-06 00:21:00 +0200
committerRobin Gareus <robin@gareus.org>2016-10-06 00:58:13 +0200
commit72060df884db5615318cb190e572c77a1ecb7679 (patch)
treeb5fc9d42502df6fc96274d276aeb9681107c2987 /libs/vamp-plugins
parentf68d2e06bcfb81efda107d3b4c3aa7dbc2d73bc2 (diff)
update OnsetDetector for updated QM-DSP
Diffstat (limited to 'libs/vamp-plugins')
-rw-r--r--libs/vamp-plugins/OnsetDetect.cpp21
1 files changed, 9 insertions, 12 deletions
diff --git a/libs/vamp-plugins/OnsetDetect.cpp b/libs/vamp-plugins/OnsetDetect.cpp
index ea1760412b..2a34791951 100644
--- a/libs/vamp-plugins/OnsetDetect.cpp
+++ b/libs/vamp-plugins/OnsetDetect.cpp
@@ -354,7 +354,7 @@ OnsetDetector::process(const float *const *inputBuffers,
return FeatureSet();
}
- size_t len = m_d->dfConfig.frameLength / 2;
+ size_t len = m_d->dfConfig.frameLength / 2 + 1;
// float mean = 0.f;
// for (size_t i = 0; i < len; ++i) {
@@ -366,25 +366,22 @@ OnsetDetector::process(const float *const *inputBuffers,
// std::cerr << "OnsetDetector::process(" << timestamp << "): "
// << "dftype " << m_dfType << ", sens " << m_sensitivity
-// << ", len " << len << std::endl;
+// << ", len " << len << ", mean " << mean << std::endl;
- double *magnitudes = new double[len];
- double *phases = new double[len];
+ double *reals = new double[len];
+ double *imags = new double[len];
// We only support a single input channel
for (size_t i = 0; i < len; ++i) {
-
- magnitudes[i] = sqrt(inputBuffers[0][i*2 ] * inputBuffers[0][i*2 ] +
- inputBuffers[0][i*2+1] * inputBuffers[0][i*2+1]);
-
- phases[i] = atan2(-inputBuffers[0][i*2+1], inputBuffers[0][i*2]);
+ reals[i] = inputBuffers[0][i*2];
+ imags[i] = inputBuffers[0][i*2+1];
}
- double output = m_d->df->process(magnitudes, phases);
+ double output = m_d->df->processFrequencyDomain(reals, imags);
- delete[] magnitudes;
- delete[] phases;
+ delete[] reals;
+ delete[] imags;
if (m_d->dfOutput.empty()) m_d->origin = timestamp;