src/pitch/pitch.h: add aubio_pitch_get_tolerance
authorPaul Brossier <piem@piem.org>
Wed, 28 Sep 2016 00:23:16 +0000 (02:23 +0200)
committerPaul Brossier <piem@piem.org>
Wed, 28 Sep 2016 00:23:16 +0000 (02:23 +0200)
src/pitch/pitch.c
src/pitch/pitch.h

index bee0ea3..5d9a756 100644 (file)
@@ -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)
 {
index e0ae545..0f34c6c 100644 (file)
@@ -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()