examples/aubioonset.c: use interpolated onset position
authorPaul Brossier <piem@piem.org>
Tue, 6 Oct 2009 15:06:30 +0000 (17:06 +0200)
committerPaul Brossier <piem@piem.org>
Tue, 6 Oct 2009 15:06:30 +0000 (17:06 +0200)
examples/aubioonset.c
examples/utils.c
examples/utils.h

index ea9f12f3c746b203ff96196f763c4f4255e9b301..1d412e31ecfbbd31669ee0befe1a49cdc4fdaa68 100644 (file)
@@ -43,11 +43,11 @@ int aubio_process(smpl_t **input, smpl_t **output, int nframes) {
         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 @@ void process_print (void) {
        * 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 @@ void process_print (void) {
 }
 
 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();
index 304fb47b6fcf909d9e6fd167cd25fff957680839..fe86ef8c15dc2989cb855b7c05e7d6e464b41fe3 100644 (file)
@@ -67,7 +67,7 @@ aubio_onsetdetection_t *o;
 aubio_onsetdetection_t *o2;
 fvec_t *onset;
 fvec_t *onset2;
-int isonset = 0;
+smpl_t isonset = 0;
 aubio_pickpeak_t *parms;
 
 
index 5901c1f49b54eaadfd03c968ecaedfbaff0b93c6..b3acf328b3d81550b00ff717b70ad874292b590d 100644 (file)
@@ -100,7 +100,7 @@ extern aubio_onsetdetection_t *o;
 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;