#include "onset/onset.h"
#include "notes/notes.h"
+#define DEFAULT_NOTES_SILENCE -50.
+
struct _aubio_notes_t {
uint_t onset_buf_size;
o->pitch_output = new_fvec (1);
if (strcmp(method, "default") != 0) {
- AUBIO_ERR("unknown notes detection method %s, using default.\n",
- method);
+ AUBIO_ERR("notes: unknown notes detection method \"%s\"\n", method);
goto fail;
}
o->note_buffer = new_fvec(o->median);
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;
+ }
+ o->silence_threshold = silence;
+ 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