From 17b08e6f755363a97f44fe0d630c994e447b53d7 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 17 Dec 2016 12:10:53 +0100 Subject: [PATCH] src/notes/notes.h: add aubio_notes_{get,set}_minioi_ms --- src/notes/notes.c | 14 ++++++++++++++ src/notes/notes.h | 21 +++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/src/notes/notes.c b/src/notes/notes.c index 843aa0be..ccfe0029 100644 --- a/src/notes/notes.c +++ b/src/notes/notes.c @@ -119,6 +119,20 @@ smpl_t aubio_notes_get_silence(const aubio_notes_t *o) return aubio_pitch_get_silence(o->pitch); } +uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms) +{ + uint_t err = AUBIO_OK; + if (!o->onset || (aubio_onset_set_minioi_ms(o->onset, minioi_ms) != 0)) { + err = AUBIO_FAIL; + } + return err; +} + +smpl_t aubio_notes_get_minioi_ms(const aubio_notes_t *o) +{ + return aubio_pitch_get_silence(o->pitch); +} + /** append new note candidate to the note_buffer and return filtered value. we * need to copy the input array as fvec_median destroy its input data.*/ static void diff --git a/src/notes/notes.h b/src/notes/notes.h index 3732b80c..bf0df85b 100644 --- a/src/notes/notes.h +++ b/src/notes/notes.h @@ -73,6 +73,8 @@ void aubio_notes_do (aubio_notes_t *o, const fvec_t * input, fvec_t * output); \param o notes detection object as returned by new_aubio_notes() \param silence new silence detection threshold + \return 0 on success, non-zero otherwise + */ uint_t aubio_notes_set_silence(aubio_notes_t * o, smpl_t silence); @@ -85,6 +87,25 @@ uint_t aubio_notes_set_silence(aubio_notes_t * o, smpl_t silence); */ smpl_t aubio_notes_get_silence(const aubio_notes_t * o); +/** get notes detection minimum inter-onset interval, in millisecond + + \param o notes detection object as returned by new_aubio_notes() + + \return current minimum inter onset interval + + */ +smpl_t aubio_notes_get_minioi_ms(const aubio_notes_t *o); + +/** set notes detection minimum inter-onset interval, in millisecond + + \param o notes detection object as returned by new_aubio_notes() + \param minioi_ms new inter-onset interval + + \return 0 on success, non-zero otherwise + +*/ +uint_t aubio_notes_set_minioi_ms (aubio_notes_t *o, smpl_t minioi_ms); + #ifdef __cplusplus } #endif -- 2.11.0