Changeset 65c352e


Ignore:
Timestamp:
Aug 14, 2015, 7:16:26 PM (5 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, sampler
Children:
695e171
Parents:
7ac374d
Message:

src/onset/onset.c: add aubio_onset_default_parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/onset.c

    r7ac374d r65c352e  
    2828#include "mathutils.h"
    2929#include "onset/onset.h"
     30
     31void aubio_onset_default_parameters (aubio_onset_t *o, char_t * method);
    3032
    3133/** structure to store object state */
     
    233235  o->desc = new_fvec(1);
    234236
    235   /* set some default parameter */
    236   aubio_onset_set_threshold (o, 0.3);
    237   aubio_onset_set_delay(o, 4.3 * hop_size);
    238   aubio_onset_set_minioi_ms(o, 20.);
    239   aubio_onset_set_silence(o, -70.);
    240 
    241237  o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate);
    242   o->apply_adaptive_whitening = 0;
     238
     239  aubio_onset_default_parameters (o, onset_mode);
    243240
    244241  /* initialize internal variables */
     
    250247  AUBIO_FREE(o);
    251248  return NULL;
     249}
     250
     251void aubio_onset_default_parameters (aubio_onset_t * o, char_t * onset_mode)
     252{
     253  /* set some default parameter */
     254  aubio_onset_set_threshold (o, 0.3);
     255  aubio_onset_set_delay (o, 4.3 * o->hop_size);
     256  aubio_onset_set_minioi_ms (o, 50.);
     257  aubio_onset_set_silence (o, -70.);
     258  aubio_onset_set_adaptive_whitening (o, 1);
     259
     260  /* method specific optimisations */
     261  if (strcmp (onset_mode, "energy") == 0) {
     262  } else if (strcmp (onset_mode, "hfc") == 0) {
     263    aubio_onset_set_adaptive_whitening (o, 0);
     264  } else if (strcmp (onset_mode, "complexdomain") == 0
     265             || strcmp (onset_mode, "complex") == 0) {
     266    aubio_onset_set_delay (o, 4.6 * o->hop_size);
     267    aubio_onset_set_threshold (o, 0.15);
     268  } else if (strcmp (onset_mode, "phase") == 0) {
     269    aubio_onset_set_adaptive_whitening (o, 0);
     270  } else if (strcmp (onset_mode, "mkl") == 0) {
     271    aubio_onset_set_threshold (o, 0.05);
     272  } else if (strcmp (onset_mode, "kl") == 0) {
     273    aubio_onset_set_threshold (o, 0.35);
     274  } else if (strcmp (onset_mode, "specflux") == 0) {
     275    aubio_onset_set_threshold (o, 0.4);
     276  } else if (strcmp (onset_mode, "specdiff") == 0) {
     277  } else if (strcmp (onset_mode, "default") == 0) {
     278  } else {
     279    AUBIO_ERR ("onset: unknown spectral descriptor type %s, "
     280               "using default parameters.\n", onset_mode);
     281  }
    252282}
    253283
Note: See TracChangeset for help on using the changeset viewer.