{
fvec_t *yin;
smpl_t tol;
- smpl_t confidence;
+ uint_t peak_pos;
};
+#if 0
/** compute difference function
\param input input signal
*/
uint_t aubio_pitchyin_getpitch (const fvec_t * yinbuf);
+#endif
aubio_pitchyin_t *
new_aubio_pitchyin (uint_t bufsize)
aubio_pitchyin_t *o = AUBIO_NEW (aubio_pitchyin_t);
o->yin = new_fvec (bufsize / 2);
o->tol = 0.15;
+ o->peak_pos = 0;
return o;
}
AUBIO_FREE (o);
}
+#if 0
/* outputs the difference function */
void
aubio_pitchyin_diff (fvec_t * input, fvec_t * yin)
//AUBIO_DBG("No pitch found");
return 0;
}
+#endif
/* all the above in one */
void
period = tau - 3;
if (tau > 4 && (yin_data[period] < tol) &&
(yin_data[period] < yin_data[period + 1])) {
- out->data[0] = fvec_quadratic_peak_pos (yin, period);
- goto beach;
+ o->peak_pos = (uint_t)period;
+ out->data[0] = fvec_quadratic_peak_pos (yin, o->peak_pos);
+ return;
}
}
- out->data[0] = fvec_quadratic_peak_pos (yin, fvec_min_elem (yin));
-beach:
- return;
+ o->peak_pos = (uint_t)fvec_min_elem (yin);
+ out->data[0] = fvec_quadratic_peak_pos (yin, o->peak_pos);
}
smpl_t
aubio_pitchyin_get_confidence (aubio_pitchyin_t * o) {
- o->confidence = 1. - fvec_min (o->yin);
- return o->confidence;
+ return 1. - o->yin->data[o->peak_pos];
}
uint_t