libmain.cpp, plugins/: update to GPLv3
[vamp-aubio-plugins.git] / plugins / Onset.cpp
index e5875c5..cb93366 100644 (file)
@@ -6,11 +6,20 @@
     Centre for Digital Music, Queen Mary, University of London.
     This file copyright 2006 Chris Cannam.
     
-    This program is free software; you can redistribute it and/or
-    modify it under the terms of the GNU General Public License as
-    published by the Free Software Foundation; either version 2 of the
-    License, or (at your option) any later version.  See the file
-    COPYING included with this distribution for more information.
+    This file is part of vamp-aubio-plugins.
+
+    vamp-aubio is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    vamp-aubio is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with aubio.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
@@ -137,6 +146,7 @@ Onset::getParameterDescriptors() const
     ParameterDescriptor desc;
     desc.identifier = "onsettype";
     desc.name = "Onset Detection Function Type";
+    desc.description = "Type of onset detection function to use";
     desc.minValue = 0;
     desc.maxValue = 7;
     desc.defaultValue = (int)OnsetComplex;
@@ -155,6 +165,7 @@ Onset::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "peakpickthreshold";
     desc.name = "Peak Picker Threshold";
+    desc.description = "Threshold used for peak picking, the higher the more detections";
     desc.minValue = 0;
     desc.maxValue = 1;
     desc.defaultValue = 0.3;
@@ -164,6 +175,7 @@ Onset::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "silencethreshold";
     desc.name = "Silence Threshold";
+    desc.description = "Silence threshold, the higher the least detection";
     desc.minValue = -120;
     desc.maxValue = 0;
     desc.defaultValue = -70;
@@ -174,6 +186,7 @@ Onset::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "minioi";
     desc.name = "Minimum Inter-Onset Interval";
+    desc.description = "Time interval below which two consecutive onsets should be merged";
     desc.minValue = 0;
     desc.maxValue = 40;
     desc.defaultValue = 4;
@@ -232,6 +245,7 @@ Onset::getOutputDescriptors() const
     OutputDescriptor d;
     d.identifier = "onsets";
     d.name = "Onsets";
+    d.description = "List of times at which a note onset was detected";
     d.unit = "";
     d.hasFixedBinCount = true;
     d.binCount = 0;
@@ -239,6 +253,24 @@ Onset::getOutputDescriptors() const
     d.sampleRate = 0;
     list.push_back(d);
 
+    d.identifier = "odf";
+    d.name = "Onset detection function";
+    d.description = "Output of the onset detection function";
+    d.binCount = 1;
+    d.isQuantized = true;
+    d.quantizeStep = 1.0;
+    d.sampleType = OutputDescriptor::OneSamplePerStep;
+    list.push_back(d);
+
+    d.identifier = "todf";
+    d.name = "Thresholded Onset detection function";
+    d.description = "Output of the thresholded onset detection function";
+    d.binCount = 1;
+    d.isQuantized = true;
+    d.quantizeStep = 1.0;
+    d.sampleType = OutputDescriptor::OneSamplePerStep;
+    list.push_back(d);
+
     return list;
 }
 
@@ -247,7 +279,7 @@ Onset::process(const float *const *inputBuffers,
                Vamp::RealTime timestamp)
 {
     for (size_t i = 0; i < m_stepSize; ++i) {
-        fvec_write_sample(m_ibuf, inputBuffers[0][i], i);
+        fvec_set_sample(m_ibuf, inputBuffers[0][i], i);
     }
 
     aubio_onset_do(m_onsetdet, m_ibuf, m_onset);
@@ -267,6 +299,16 @@ Onset::process(const float *const *inputBuffers,
         }
     }
 
+    Feature odf;
+    odf.hasTimestamp = false;
+    odf.values.push_back(aubio_onset_get_descriptor(m_onsetdet));
+    returnFeatures[1].push_back(odf);
+
+    Feature todf;
+    todf.hasTimestamp = false;
+    todf.values.push_back(aubio_onset_get_thresholded_descriptor(m_onsetdet));
+    returnFeatures[2].push_back(todf);
+
     return returnFeatures;
 }