From 4cf321505a5678e08f8c203a3aaa5566c10e1798 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 25 Oct 2015 00:52:21 +0200 Subject: [PATCH] src/ofxAubioPitch.cpp: add confidence --- src/ofxAubioPitch.cpp | 2 ++ src/ofxAubioPitch.h | 1 + 2 files changed, 3 insertions(+) diff --git a/src/ofxAubioPitch.cpp b/src/ofxAubioPitch.cpp index 456d7e1..b523895 100644 --- a/src/ofxAubioPitch.cpp +++ b/src/ofxAubioPitch.cpp @@ -37,6 +37,7 @@ void ofxAubioPitch::setup(string method, int buf_s, int hop_s, int samplerate) pitch = new_aubio_pitch((char_t*)method.c_str(), buf_size, hop_size, samplerate); aubio_pitch_set_unit(pitch, (char_t*)"midi"); + aubio_pitch_set_tolerance(pitch, 0.7); aubio_input = new_fvec(hop_size); aubio_output = new_fvec(1); curpos = 0; @@ -83,5 +84,6 @@ void ofxAubioPitch::blockAudioIn() if (aubio_output->data[0]) { //ofLogNotice() << "found pitch: " << aubio_output->data[0]; latestPitch = aubio_output->data[0]; + pitchConfidence = aubio_pitch_get_confidence(pitch); } } diff --git a/src/ofxAubioPitch.h b/src/ofxAubioPitch.h index c29075a..28e91b5 100644 --- a/src/ofxAubioPitch.h +++ b/src/ofxAubioPitch.h @@ -38,6 +38,7 @@ class ofxAubioPitch { void audioIn(float *input, int bufferSize, int nChannels); float latestPitch; + float pitchConfidence; private: void blockAudioIn(); -- 2.11.0