From bfa7ccefd22d060efb4e2608154090182e530c0e Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 25 Oct 2015 04:35:07 +0100 Subject: [PATCH] src/ofxAubioOnset.cpp: add threshold, novelty, thresholdedNovelty --- src/ofxAubioOnset.cpp | 9 ++++++++- src/ofxAubioOnset.h | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/ofxAubioOnset.cpp b/src/ofxAubioOnset.cpp index 3a6e6f7..a0c49f9 100644 --- a/src/ofxAubioOnset.cpp +++ b/src/ofxAubioOnset.cpp @@ -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); } diff --git a/src/ofxAubioOnset.h b/src/ofxAubioOnset.h index 152ae79..ce32dfb 100644 --- a/src/ofxAubioOnset.h +++ b/src/ofxAubioOnset.h @@ -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(); -- 2.11.0