From 7ac374d95400d715b37dd4254ae55054c1bacd6f Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Thu, 13 Aug 2015 22:39:29 +0200 Subject: [PATCH] src/onset/onset.{c,h}: add method to set adaptive whitening --- src/onset/onset.c | 13 ++++++++++++- src/onset/onset.h | 17 +++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/onset/onset.c b/src/onset/onset.c index 6579d65a..fb215fee 100644 --- a/src/onset/onset.c +++ b/src/onset/onset.c @@ -112,6 +112,17 @@ smpl_t aubio_onset_get_last_ms (aubio_onset_t *o) return aubio_onset_get_last_s (o) * 1000.; } +uint_t aubio_onset_set_adaptive_whitening (aubio_onset_t *o, uint_t apply_adaptive_whitening) +{ + o->apply_adaptive_whitening = apply_adaptive_whitening; + return AUBIO_OK; +} + +uint_t aubio_onset_get_adaptive_whitening (aubio_onset_t *o) +{ + return o->apply_adaptive_whitening; +} + uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence) { o->silence = silence; return AUBIO_OK; @@ -228,7 +239,7 @@ aubio_onset_t * new_aubio_onset (char_t * onset_mode, aubio_onset_set_silence(o, -70.); o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate); - o->apply_adaptive_whitening = 1; + o->apply_adaptive_whitening = 0; /* initialize internal variables */ o->last_onset = 0; diff --git a/src/onset/onset.h b/src/onset/onset.h index cda8d9ab..984d35cf 100644 --- a/src/onset/onset.h +++ b/src/onset/onset.h @@ -117,6 +117,23 @@ smpl_t aubio_onset_get_last_s (aubio_onset_t *o); */ smpl_t aubio_onset_get_last_ms (aubio_onset_t *o); +/** set onset detection adaptive whitening + + \param o onset detection object as returned by new_aubio_onset() + \param apply_adaptive_whitening 1 to enable, 0 to disable + +*/ +uint_t aubio_onset_set_adaptive_whitening(aubio_onset_t * o, uint_t apply_adaptive_whitening); + +/** get onset detection silence threshold + + \param o onset detection object as returned by new_aubio_onset() + + \return adaptive whitening mode, 1 if enabled, 0 otherwise + +*/ +uint_t aubio_onset_get_adaptive_whitening(aubio_onset_t * o); + /** set onset detection silence threshold \param o onset detection object as returned by new_aubio_onset() -- 2.11.0