src/ofxAubioOnset.cpp: add threshold, novelty, thresholdedNovelty
authorPaul Brossier <piem@piem.org>
Sun, 25 Oct 2015 03:35:07 +0000 (04:35 +0100)
committerPaul Brossier <piem@piem.org>
Sun, 25 Oct 2015 03:35:07 +0000 (04:35 +0100)
src/ofxAubioOnset.cpp
src/ofxAubioOnset.h

index 3a6e6f7..a0c49f9 100644 (file)
@@ -36,6 +36,7 @@ void ofxAubioOnset::setup(string method, int buf_s, int hop_s, int samplerate)
     onset = new_aubio_onset((char_t*)method.c_str(),
                             buf_size, hop_size, samplerate);
     if (onset) {
+        threshold = aubio_onset_get_threshold(onset);
         ofLogNotice() << "created ofxAubioOnset(" << method
           << ", " << buf_size
           << ", " << hop_size
@@ -58,5 +59,11 @@ void ofxAubioOnset::blockAudioIn()
         toSend = true;
         //ofLogNotice() << "found onset";
     }
-    latestDescriptor = aubio_onset_get_descriptor(onset);
+    novelty = aubio_onset_get_descriptor(onset);
+    thresholdedNovelty = aubio_onset_get_thresholded_descriptor(onset);
+}
+
+void ofxAubioOnset::setThreshold(float threshold)
+{
+    aubio_onset_set_threshold(onset, threshold);
 }
index 152ae79..ce32dfb 100644 (file)
@@ -34,7 +34,11 @@ class ofxAubioOnset : public ofxAubioBlock {
        void setup();
        void setup(std::string method, int buf_s, int hop_s, int samplerate);
 
-       float latestDescriptor = 0;
+       void setThreshold(float threshold);
+
+       float novelty = 0;
+       float thresholdedNovelty = 0;
+       float threshold;
 
     private:
        void blockAudioIn();