plugins/Notes.cpp: add descriptions
[vamp-aubio-plugins.git] / plugins / Notes.cpp
index e2cbfe5..cd4d807 100644 (file)
@@ -105,10 +105,21 @@ Notes::initialise(size_t channels, size_t stepSize, size_t blockSize)
     m_onset = new_fvec(1);
     m_pitch = new_fvec(1);
 
+    reset();
+
+    return true;
+}
+
+void
+Notes::reset()
+{
+    if (m_onsetdet) del_aubio_onset(m_onsetdet);
+    if (m_pitchdet) del_aubio_pitch(m_pitchdet);
+
     m_onsetdet = new_aubio_onset
         (const_cast<char *>(getAubioNameForOnsetType(m_onsettype)),
-         blockSize,
-         stepSize,
+         m_blockSize,
+         m_stepSize,
          lrintf(m_inputSampleRate));
     
     aubio_onset_set_threshold(m_onsetdet, m_threshold);
@@ -117,8 +128,8 @@ Notes::initialise(size_t channels, size_t stepSize, size_t blockSize)
 
     m_pitchdet = new_aubio_pitch
         (const_cast<char *>(getAubioNameForPitchType(m_pitchtype)),
-         blockSize,
-         stepSize,
+         m_blockSize,
+         m_stepSize,
          lrintf(m_inputSampleRate));
 
     aubio_pitch_set_unit(m_pitchdet, const_cast<char *>("freq"));
@@ -129,13 +140,6 @@ Notes::initialise(size_t channels, size_t stepSize, size_t blockSize)
     m_currentOnset = Vamp::RealTime::zeroTime;
     m_haveCurrent = false;
     m_prevPitch = -1;
-
-    return true;
-}
-
-void
-Notes::reset()
-{
 }
 
 size_t
@@ -158,6 +162,7 @@ Notes::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;
@@ -176,6 +181,7 @@ Notes::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "pitchtype";
     desc.name = "Pitch Detection Function Type";
+    desc.description = "Type of pitch detection function to use";
     desc.minValue = 0;
     desc.maxValue = 4;
     desc.defaultValue = (int)PitchYinFFT;
@@ -191,6 +197,7 @@ Notes::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "minpitch";
     desc.name = "Minimum Pitch";
+    desc.description = "Lower pitch value to look for";
     desc.minValue = 0;
     desc.maxValue = 127;
     desc.defaultValue = 32;
@@ -202,6 +209,7 @@ Notes::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "maxpitch";
     desc.name = "Maximum Pitch";
+    desc.description = "Highest pitch value to look for";
     desc.minValue = 0;
     desc.maxValue = 127;
     desc.defaultValue = 95;
@@ -213,6 +221,7 @@ Notes::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "wraprange";
     desc.name = "Fold Higher or Lower Notes into Range";
+    desc.description = "Notes detected outside the range will be transposed to higher or lower octaves";
     desc.minValue = 0;
     desc.maxValue = 1;
     desc.defaultValue = 0;
@@ -223,6 +232,7 @@ Notes::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "avoidleaps";
     desc.name = "Avoid Multi-Octave Jumps";
+    desc.description = "Minimize octave jumps by transposing to the octave of the previously detected note";
     desc.minValue = 0;
     desc.maxValue = 1;
     desc.defaultValue = 0;
@@ -233,6 +243,7 @@ Notes::getParameterDescriptors() const
     desc = ParameterDescriptor();
     desc.identifier = "peakpickthreshold";
     desc.name = "Peak Picker Threshold";
+    desc.description = "Peak picking threshold, the higher the least detection";
     desc.minValue = 0;
     desc.maxValue = 1;
     desc.defaultValue = 0.3;
@@ -242,6 +253,7 @@ Notes::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;
@@ -252,6 +264,7 @@ Notes::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;
@@ -336,6 +349,7 @@ Notes::getOutputDescriptors() const
     OutputDescriptor d;
     d.identifier = "notes";
     d.name = "Notes";
+    d.description = "Midi style notes";
     d.unit = "Hz";
     d.hasFixedBinCount = true;
 
@@ -357,7 +371,7 @@ Notes::FeatureSet
 Notes::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);