From 0cf2b4484419c37472d823d4e9872ca05008f18a Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Wed, 28 Sep 2016 02:23:16 +0200 Subject: [PATCH] src/pitch/pitch.h: add aubio_pitch_get_tolerance --- src/pitch/pitch.c | 17 +++++++++++++++++ src/pitch/pitch.h | 8 ++++++++ 2 files changed, 25 insertions(+) diff --git a/src/pitch/pitch.c b/src/pitch/pitch.c index bee0ea33..5d9a7560 100644 --- a/src/pitch/pitch.c +++ b/src/pitch/pitch.c @@ -324,6 +324,23 @@ aubio_pitch_set_tolerance (aubio_pitch_t * p, smpl_t tol) return AUBIO_OK; } +smpl_t +aubio_pitch_get_tolerance (aubio_pitch_t * p) +{ + smpl_t tolerance = 1.; + switch (p->type) { + case aubio_pitcht_yin: + tolerance = aubio_pitchyin_get_tolerance (p->p_object); + break; + case aubio_pitcht_yinfft: + tolerance = aubio_pitchyinfft_get_tolerance (p->p_object); + break; + default: + break; + } + return tolerance; +} + uint_t aubio_pitch_set_silence (aubio_pitch_t * p, smpl_t silence) { diff --git a/src/pitch/pitch.h b/src/pitch/pitch.h index e0ae5452..0f34c6c9 100644 --- a/src/pitch/pitch.h +++ b/src/pitch/pitch.h @@ -117,6 +117,14 @@ void aubio_pitch_do (aubio_pitch_t * o, const fvec_t * in, fvec_t * out); */ uint_t aubio_pitch_set_tolerance (aubio_pitch_t * o, smpl_t tol); +/** get yin or yinfft tolerance threshold + + \param o pitch detection object as returned by new_aubio_pitch() + \return tolerance (default is 0.15 for yin and 0.85 for yinfft) + +*/ +smpl_t aubio_pitch_get_tolerance (aubio_pitch_t * o); + /** deletion of the pitch detection object \param o pitch detection object as returned by new_aubio_pitch() -- 2.11.0