From 953a9e975b435a1d44a879c8086bca988f438bfd Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Mon, 15 May 2006 12:56:46 +0000 Subject: [PATCH] * Add onset detection function output. --- plugins/Onset.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/plugins/Onset.cpp b/plugins/Onset.cpp index 089f5e1..68322d8 100644 --- a/plugins/Onset.cpp +++ b/plugins/Onset.cpp @@ -31,7 +31,8 @@ Onset::Onset(float inputSampleRate) : m_onsetdet(0), m_onsettype(aubio_onset_mkl), m_threshold(0.3), - m_silence(-90) + m_silence(-90), + m_channelCount(1) { } @@ -215,6 +216,17 @@ Onset::getOutputDescriptors() const d.sampleType = OutputDescriptor::OneSamplePerStep; list.push_back(d); + d = OutputDescriptor(); + d.name = "detectionfunction"; + d.unit = ""; + d.description = "Onset Detection Function"; + d.hasFixedBinCount = true; + d.binCount = m_channelCount; + d.hasKnownExtents = false; + d.isQuantized = false; + d.sampleType = OutputDescriptor::OneSamplePerStep; + list.push_back(d); + return list; } @@ -243,6 +255,11 @@ Onset::process(float **inputBuffers, Vamp::RealTime /* timestamp */) if (isonset) { returnFeatures[0].push_back(Feature()); } + Feature feature; + for (size_t j = 0; j < m_channelCount; ++j) { + feature.values.push_back(m_onset->data[j][0]); + } + returnFeatures[1].push_back(feature); return returnFeatures; } -- 2.11.0