src/onset/peakpick.c: use quadint in peakpick to get interpolated peak position,...
authorPaul Brossier <piem@piem.org>
Mon, 5 Oct 2009 17:40:45 +0000 (19:40 +0200)
committerPaul Brossier <piem@piem.org>
Mon, 5 Oct 2009 17:40:45 +0000 (19:40 +0200)
src/onset/onset.c
src/onset/peakpick.c
src/onset/peakpick.h

index 3b30a7b..e7dd31a 100644 (file)
@@ -51,7 +51,7 @@ void aubio_onset(aubio_onset_t *o, fvec_t * input, fvec_t * onset)
     onset->data[0][0] *= onset2->data[0][0];
   }*/
   isonset = aubio_peakpick_pimrt(o->of,o->pp);
-  if (isonset) {
+  if (isonset > 0.) {
     if (aubio_silence_detection(input, o->silence)==1) {
       isonset  = 0;
       wasonset++;
index 1ed0fe8..9c8551d 100644 (file)
@@ -67,12 +67,13 @@ struct _aubio_pickpeak_t {
 /** modified version for real time, moving mean adaptive threshold this method
  * is slightly more permissive than the offline one, and yelds to an increase
  * of false positives. best  */
-uint_t aubio_peakpick_pimrt(fvec_t * onset,  aubio_pickpeak_t * p) {
+smpl_t aubio_peakpick_pimrt(fvec_t * onset,  aubio_pickpeak_t * p) {
        fvec_t * onset_keep = (fvec_t *)p->onset_keep;
        fvec_t * onset_proc = (fvec_t *)p->onset_proc;
        fvec_t * onset_peek = (fvec_t *)p->onset_peek;
        fvec_t * scratch    = (fvec_t *)p->scratch;
        smpl_t mean = 0., median = 0.;
+  smpl_t isonset = 0.;
        uint_t length = p->win_post + p->win_pre + 1;
        uint_t i = 0, j;
 
@@ -109,7 +110,11 @@ uint_t aubio_peakpick_pimrt(fvec_t * onset,  aubio_pickpeak_t * p) {
                onset_proc->data[i][p->win_post] - median - mean * p->threshold;
        /* } */
        //AUBIO_DBG("%f\n", onset_peek->data[0][2]);
-       return (p->pickerfn)(onset_peek,1);
+  isonset = (p->pickerfn)(onset_peek,1);
+  if (isonset) { //(isonset) {
+    isonset = fvec_quadint(onset_peek, 1, 1);
+  }
+       return isonset;
 }
 
 /** this method returns the current value in the pick peaking buffer
index 3d391f4..c28e108 100644 (file)
@@ -40,7 +40,7 @@ typedef struct _aubio_pickpeak_t aubio_pickpeak_t;
 /** peak-picker creation function */
 aubio_pickpeak_t * new_aubio_peakpicker(smpl_t threshold);
 /** real time peak picking function */
-uint_t aubio_peakpick_pimrt(fvec_t * DF, aubio_pickpeak_t * p);
+smpl_t aubio_peakpick_pimrt(fvec_t * DF, aubio_pickpeak_t * p);
 /** function added by Miguel Ramirez to return the onset detection amplitude in peakval */
 uint_t aubio_peakpick_pimrt_wt( fvec_t* DF, aubio_pickpeak_t* p, smpl_t* peakval );
 /** get current peak value */