From: Paul Brossier Date: Sun, 25 Oct 2015 03:35:07 +0000 (+0100) Subject: src/ofxAubioOnset.cpp: add threshold, novelty, thresholdedNovelty X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=bfa7ccefd22d060efb4e2608154090182e530c0e;p=ofxAubio.git src/ofxAubioOnset.cpp: add threshold, novelty, thresholdedNovelty --- 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();