From: Paul Brossier Date: Fri, 10 Mar 2017 23:12:44 +0000 (+0100) Subject: src/onset/onset.c: add logarithmic compression X-Git-Tag: 0.4.5~20^2~26 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=63520340a33fc38f966e6a3f39beb55ee4d3f0b7;p=aubio.git src/onset/onset.c: add logarithmic compression Using these default parameters with the good old HFC, we reach the following scores: mirex-2005 | F 80.393 | P 80.841 | R 79.950 | TP 7616 | FP 1360 | Tot 9526 holzapfel | F 69.441 | P 77.803 | R 62.702 | TP 1360 | FP 388 | Tot 2169 --- diff --git a/src/onset/onset.c b/src/onset/onset.c index d29c8440..fa612617 100644 --- a/src/onset/onset.c +++ b/src/onset/onset.c @@ -46,6 +46,8 @@ struct _aubio_onset_t { uint_t total_frames; /**< total number of frames processed since the beginning */ uint_t last_onset; /**< last detected onset location, in frames */ + uint_t apply_compression; + smpl_t lambda_compression; uint_t apply_adaptive_whitening; aubio_spectral_whitening_t *spectral_whitening; }; @@ -58,12 +60,13 @@ void aubio_onset_do (aubio_onset_t *o, const fvec_t * input, fvec_t * onset) /* if (apply_filtering) { } - if (apply_compression) { - } */ if (o->apply_adaptive_whitening) { aubio_spectral_whitening_do(o->spectral_whitening, o->fftgrain); } + if (o->apply_compression) { + cvec_logmag(o->fftgrain, o->apply_compression); + } aubio_specdesc_do (o->od, o->fftgrain, o->desc); aubio_peakpicker_do(o->pp, o->desc, onset); isonset = onset->data[0]; @@ -259,17 +262,26 @@ void aubio_onset_default_parameters (aubio_onset_t * o, const char_t * onset_mod aubio_onset_set_delay (o, 4.3 * o->hop_size); aubio_onset_set_minioi_ms (o, 50.); aubio_onset_set_silence (o, -70.); - aubio_onset_set_adaptive_whitening (o, 1); + aubio_onset_set_adaptive_whitening (o, 0); + + o->apply_compression = 0; + o->lambda_compression = 1.; /* method specific optimisations */ if (strcmp (onset_mode, "energy") == 0) { } else if (strcmp (onset_mode, "hfc") == 0 || strcmp (onset_mode, "default") == 0) { + aubio_onset_set_threshold (o, 0.058); + o->apply_compression = 1; + o->lambda_compression = 1.; aubio_onset_set_adaptive_whitening (o, 0); } else if (strcmp (onset_mode, "complexdomain") == 0 || strcmp (onset_mode, "complex") == 0) { aubio_onset_set_delay (o, 4.6 * o->hop_size); aubio_onset_set_threshold (o, 0.15); + o->apply_compression = 1; + o->lambda_compression = 1.; } else if (strcmp (onset_mode, "phase") == 0) { + o->apply_compression = 0; aubio_onset_set_adaptive_whitening (o, 0); } else if (strcmp (onset_mode, "mkl") == 0) { aubio_onset_set_threshold (o, 0.05);