Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/onset.c

    r65c352e r763a7f1  
    2424#include "spectral/specdesc.h"
    2525#include "spectral/phasevoc.h"
    26 #include "spectral/awhitening.h"
    2726#include "onset/peakpicker.h"
    2827#include "mathutils.h"
    2928#include "onset/onset.h"
    30 
    31 void aubio_onset_default_parameters (aubio_onset_t *o, char_t * method);
    3229
    3330/** structure to store object state */
     
    4643  uint_t total_frames;          /**< total number of frames processed since the beginning */
    4744  uint_t last_onset;            /**< last detected onset location, in frames */
    48 
    49   uint_t apply_adaptive_whitening;
    50   aubio_spectral_whitening_t *spectral_whitening;
    5145};
    5246
     
    5650  smpl_t isonset = 0;
    5751  aubio_pvoc_do (o->pv,input, o->fftgrain);
    58   /*
    59   if (apply_filtering) {
    60   }
    61   if (apply_compression) {
    62   }
    63   */
    64   if (o->apply_adaptive_whitening) {
    65     aubio_spectral_whitening_do(o->spectral_whitening, o->fftgrain);
    66   }
    6752  aubio_specdesc_do (o->od, o->fftgrain, o->desc);
    6853  aubio_peakpicker_do(o->pp, o->desc, onset);
     
    115100}
    116101
    117 uint_t aubio_onset_set_adaptive_whitening (aubio_onset_t *o, uint_t apply_adaptive_whitening)
    118 {
    119   o->apply_adaptive_whitening = apply_adaptive_whitening;
    120   return AUBIO_OK;
    121 }
    122 
    123 uint_t aubio_onset_get_adaptive_whitening (aubio_onset_t *o)
    124 {
    125   return o->apply_adaptive_whitening;
    126 }
    127 
    128102uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence) {
    129103  o->silence = silence;
     
    235209  o->desc = new_fvec(1);
    236210
    237   o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate);
    238 
    239   aubio_onset_default_parameters (o, onset_mode);
     211  /* set some default parameter */
     212  aubio_onset_set_threshold (o, 0.3);
     213  aubio_onset_set_delay(o, 4.3 * hop_size);
     214  aubio_onset_set_minioi_ms(o, 20.);
     215  aubio_onset_set_silence(o, -70.);
    240216
    241217  /* initialize internal variables */
     
    249225}
    250226
    251 void 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   }
    282 }
    283 
    284227void del_aubio_onset (aubio_onset_t *o)
    285228{
    286   del_aubio_spectral_whitening(o->spectral_whitening);
    287229  del_aubio_specdesc(o->od);
    288230  del_aubio_peakpicker(o->pp);
Note: See TracChangeset for help on using the changeset viewer.