From 376946a3600f182fff1276207ead2d512b579d6d Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 15 Mar 2013 14:41:02 -0500 Subject: [PATCH] src/onset/onset.c: quick fix to get very first frame of file --- src/onset/onset.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/onset/onset.c b/src/onset/onset.c index ecf9a473..34e94fa7 100644 --- a/src/onset/onset.c +++ b/src/onset/onset.c @@ -65,6 +65,12 @@ void aubio_onset_do (aubio_onset_t *o, fvec_t * input, fvec_t * onset) } } } 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 @@ aubio_onset_t * new_aubio_onset (char_t * onset_mode, 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); -- 2.26.2