shithub: aubio

Download patch

ref: 376946a3600f182fff1276207ead2d512b579d6d
parent: 9778d9a660d6d138e0ac40502efb80c85bc417bd
author: Paul Brossier <piem@piem.org>
date: Fri Mar 15 10:41:02 EDT 2013

src/onset/onset.c: quick fix to get very first frame of file

--- a/src/onset/onset.c
+++ b/src/onset/onset.c
@@ -65,6 +65,12 @@
       }
     }
   } else {
+    if (wasonset == -1 && aubio_silence_detection(input, o->silence) == 0) {
+      //AUBIO_MSG("beginning of file is not silent, marking as onset\n",
+      //  wasonset, aubio_silence_detection(input, o->silence));
+      isonset = 4;
+      wasonset = 0;
+    }
     wasonset++;
   }
   o->wasonset->data[0] = wasonset;
@@ -107,6 +113,7 @@
   o->minioi    = 4;
   o->silence   = -70;
   o->wasonset  = new_fvec(1);
+  o->wasonset->data[0] = -1.;
   o->samplerate = samplerate;
   o->hop_size = hop_size;
   o->pv = new_aubio_pvoc(buf_size, hop_size);