From: Paul Brossier Date: Tue, 30 Nov 2004 22:28:53 +0000 (+0000) Subject: src/pitchyin.c X-Git-Tag: 0.4.0-beta1~1482 X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=09b082dcc7142901aa0b6690ddfe8b4aef572e9a;hp=65f1edc7adf261ce6a3cf8715a2b658cb2b8440e src/pitchyin.c --- diff --git a/ChangeLog b/ChangeLog index 2f6128cd..2f8b4957 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,7 @@ 2004-11-39 Paul Brossier * configure.ac: added -lmx on macosx + * python/aubiocut: seeks for local minima before peak + * src/pitchyinc.c: adds draft for all-in-one faster function 2004-10-28 Paul Brossier * src/Makefile.am: added config.h installation diff --git a/src/pitchyin.c b/src/pitchyin.c index e9abde26..61f425d3 100644 --- a/src/pitchyin.c +++ b/src/pitchyin.c @@ -86,3 +86,44 @@ uint_t aubio_pitchyin_getpitch(fvec_t * yin) { return 0; } + +/* all the above in one */ +void aubio_pitchyin_getpitchfast(fvec_t * input, fvec_t * yin){ + uint_t c,j,tau; + smpl_t tmp, tmp2; + for (c=0;cchannels;c++) + { + for (tau=0;taulength;tau++) + { + yin->data[c][tau] = 0.; + } + for (tau=1;taulength;tau++) + { + for (j=0;jlength;j++) + { + tmp = input->data[c][j] - input->data[c][j+tau]; + yin->data[c][tau] += SQR(tmp); + } + } + tmp2 = 0.; + yin->data[c][0] = 1.; + for (tau=1;taulength;tau++) + { + tmp += yin->data[c][tau]; + yin->data[c][tau] *= tau/tmp; + } + } + /* should merge the following with above */ + do + { + if(yin->data[c][tau] < 0.1) { + while (yin->data[c][tau+1] < yin->data[c][tau]) { + tau++; + } + return tau; + } + tau++; + } while (taulength); + return 0; +} +