#include "onset/onset.h"
#include "notes/notes.h"
+#define DEFAULT_NOTES_SILENCE -50.
+
struct _aubio_notes_t {
uint_t onset_buf_size;
o->curnote = -1.;
o->newnote = 0.;
- o->silence_threshold = -90.;
+ aubio_notes_set_silence(o, DEFAULT_NOTES_SILENCE);
return o;
return NULL;
}
+uint_t aubio_notes_set_silence(aubio_notes_t *o, smpl_t silence)
+{
+ uint_t err = AUBIO_OK;
+ if (aubio_pitch_set_silence(o->pitch, silence) != AUBIO_OK) {
+ err = AUBIO_FAIL;
+ }
+ if (aubio_onset_set_silence(o->onset, silence) != AUBIO_OK) {
+ err = AUBIO_FAIL;
+ }
+ return err;
+}
+
+smpl_t aubio_notes_get_silence(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
/** execute note detection on an input signal frame
\param o note detection object as returned by new_aubio_notes()
- \param in input signal of size [hop_size]
- \param out output notes of size [3] ? FIXME
+ \param input input signal of size [hop_size]
+ \param output output notes, fvec of length 3
+
+ The notes output is a vector of length 3 containing:
+ - 0. the midi note value, or 0 if no note was found
+ - 1. the note velocity
+ - 2. the midi note to turn off
*/
void aubio_notes_do (aubio_notes_t *o, const fvec_t * input, fvec_t * output);
+/** set notes detection silence threshold
+
+ \param o notes detection object as returned by new_aubio_notes()
+ \param silence new silence detection threshold
+
+*/
+uint_t aubio_notes_set_silence(aubio_notes_t * o, smpl_t silence);
+
+/** get notes detection silence threshold
+
+ \param o notes detection object as returned by new_aubio_notes()
+
+ \return current silence threshold
+
+*/
+smpl_t aubio_notes_get_silence(const aubio_notes_t * o);
+
#ifdef __cplusplus
}
#endif