From: Paul Brossier Date: Fri, 27 May 2005 23:56:41 +0000 (+0000) Subject: fixed yin overlapping and fast version X-Git-Tag: bzr2git~906 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f8714ee0615e25a50d77668df664535665a46bf7;p=aubio.git fixed yin overlapping and fast version --- diff --git a/src/pitchdetection.c b/src/pitchdetection.c index 71dbf5b9..4e5d7009 100644 --- a/src/pitchdetection.c +++ b/src/pitchdetection.c @@ -89,18 +89,21 @@ void del_aubio_pitchdetection(aubio_pitchdetection_t * p) { /** \bug ugly, should replace with function pointers or so */ smpl_t aubio_pitchdetection(aubio_pitchdetection_t *p, fvec_t * ibuf) { smpl_t pitch = 0.; - uint_t i,j = 0; + uint_t i,j = 0, overlap_size = 0; switch(p->type) { case aubio_yin: + overlap_size = p->buf->length-ibuf->length; /* do sliding window blocking */ for (i=0;ibuf->channels;i++){ - for (j=0;jbuf->length-ibuf->length;j++){ - p->buf->data[i][j] = p->buf->data[i][j+ibuf->length]; + for (j=0;jbuf->data[i][j] = + p->buf->data[i][j+ibuf->length]; } } for (i=0;ichannels;i++){ for (j=0;jlength;j++){ - p->buf->data[i][j] = ibuf->data[i][j]; + p->buf->data[i][j+overlap_size] = + ibuf->data[i][j]; } } pitch = aubio_pitchyin_getpitchfast(p->buf,p->yin, 0.5); diff --git a/src/pitchyin.c b/src/pitchyin.c index c69a4347..1bdf71c2 100644 --- a/src/pitchyin.c +++ b/src/pitchyin.c @@ -90,7 +90,7 @@ uint_t aubio_pitchyin_getpitch(fvec_t * yin) { /* all the above in one */ uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin, smpl_t tol){ uint_t c=0,j,tau = 0; - smpl_t tmp = 0, tmp2; + smpl_t tmp = 0; for (tau=0;taulength;tau++) { yin->data[c][tau] = 0.; @@ -103,8 +103,8 @@ uint_t aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin, smpl_t tol){ yin->data[c][tau] += SQR(tmp); } } - tmp2 = 0.; yin->data[c][0] = 1.; + tmp = 0.; for (tau=1;taulength;tau++) { tmp += yin->data[c][tau];