shithub: aubio

Download patch

ref: 19f1dc9b5dd9997b2b152cebacb9ff8112adc323
parent: a9e27e4fbc46cb0399971f6d1290eb957e9e030a
author: Paul Brossier <piem@piem.org>
date: Tue Oct 6 13:06:30 EDT 2009

examples/aubioonset.c: use interpolated onset position

--- a/examples/aubioonset.c
+++ b/examples/aubioonset.c
@@ -43,11 +43,11 @@
         aubio_onsetdetection(o2,fftgrain, onset2);
         onset->data[0][0] *= onset2->data[0][0];
       }
-      isonset = aubio_peakpick_pimrt(onset,parms);
+      isonset = aubio_peakpicker_do(parms, onset);
       if (isonset) {
         /* test for silence */
         if (aubio_silence_detection(ibuf, silence)==1)
-          isonset=0;
+          isonset=0.;
         else
           for (pos = 0; pos < overlap_size; pos++){
             obuf->data[0][pos] = woodblock->data[0][pos];
@@ -71,7 +71,7 @@
        * actual onset */
       if (isonset && output_filename == NULL) {
         if(frames >= 4) {
-          outmsg("%f\n",(frames-frames_delay)*overlap_size/(float)samplerate);
+          outmsg("%f\n",(frames - frames_delay + isonset)*overlap_size/(float)samplerate);
         } else if (frames < frames_delay) {
           outmsg("%f\n",0.);
         }
@@ -79,7 +79,7 @@
 }
 
 int main(int argc, char **argv) {
-  frames_delay = 4;
+  frames_delay = 3;
   examples_common_init(argc,argv);
   examples_common_process(aubio_process,process_print);
   examples_common_del();
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -67,7 +67,7 @@
 aubio_onsetdetection_t *o2;
 fvec_t *onset;
 fvec_t *onset2;
-int isonset = 0;
+smpl_t isonset = 0;
 aubio_pickpeak_t *parms;
 
 
--- a/examples/utils.h
+++ b/examples/utils.h
@@ -100,7 +100,7 @@
 extern aubio_onsetdetection_t *o2;
 extern fvec_t *onset;
 extern fvec_t *onset2;
-extern int isonset;
+extern smpl_t isonset;
 extern aubio_pickpeak_t *parms;