From: Paul Brossier Date: Sat, 8 Mar 2014 20:37:22 +0000 (-0300) Subject: src/tempo/beattracking.c: improve confidence values by using interpolated peak magnit... X-Git-Tag: 0.4.1~16 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=5fe559194738e2e4c5df4196622211c0653ecf25;p=aubio.git src/tempo/beattracking.c: improve confidence values by using interpolated peak magnitude and avoiding nan --- diff --git a/src/tempo/beattracking.c b/src/tempo/beattracking.c index 3f1708c4..5c5e01bb 100644 --- a/src/tempo/beattracking.c +++ b/src/tempo/beattracking.c @@ -421,8 +421,10 @@ smpl_t aubio_beattracking_get_confidence (aubio_beattracking_t * bt) { if (bt->gp) { - return fvec_max (bt->acfout) / fvec_sum(bt->acfout); - } else { - return 0.; + smpl_t acf_sum = fvec_sum(bt->acfout); + if (acf_sum != 0.) { + return fvec_quadratic_peak_mag (bt->acfout, bt->gp) / acf_sum; + } } + return 0.; }