src/onset/onset.c: avoid doubled onset at start
authorPaul Brossier <piem@piem.org>
Sun, 24 Aug 2014 14:32:58 +0000 (09:32 -0500)
committerPaul Brossier <piem@piem.org>
Sun, 24 Aug 2014 14:32:58 +0000 (09:32 -0500)
src/onset/onset.c

index 115f4c6..04002ff 100644 (file)
@@ -68,7 +68,7 @@ void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset)
     }
   } else {
     // we are at the beginning of the file, and we don't find silence
-    if (o->total_frames == 0 && aubio_silence_detection(input, o->silence) == 0) {
+    if (o->total_frames <= o->delay && o->last_onset < o ->minioi && aubio_silence_detection(input, o->silence) == 0) {
       //AUBIO_DBG ("beginning of file is not silent, marking as onset\n");
       isonset = o->delay / o->hop_size;
       o->last_onset = o->delay;