shithub: aubio

Download patch

ref: 0cf2b4484419c37472d823d4e9872ca05008f18a
parent: 1b572743b12f4a1b473c1a43df9367f75837d826
author: Paul Brossier <piem@piem.org>
date: Tue Sep 27 22:23:16 EDT 2016

src/pitch/pitch.h: add aubio_pitch_get_tolerance

--- a/src/pitch/pitch.c
+++ b/src/pitch/pitch.c
@@ -324,6 +324,23 @@
   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)
 {
--- a/src/pitch/pitch.h
+++ b/src/pitch/pitch.h
@@ -117,6 +117,14 @@
 */
 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()