Changes in src/onset/onset.c [6352034:078dad8]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/onset/onset.c
r6352034 r078dad8 24 24 #include "spectral/specdesc.h" 25 25 #include "spectral/phasevoc.h" 26 #include "spectral/awhitening.h"27 26 #include "onset/peakpicker.h" 28 27 #include "mathutils.h" 29 28 #include "onset/onset.h" 30 31 void aubio_onset_default_parameters (aubio_onset_t *o, const char_t * method);32 29 33 30 /** structure to store object state */ … … 46 43 uint_t total_frames; /**< total number of frames processed since the beginning */ 47 44 uint_t last_onset; /**< last detected onset location, in frames */ 48 49 uint_t apply_compression;50 smpl_t lambda_compression;51 uint_t apply_adaptive_whitening;52 aubio_spectral_whitening_t *spectral_whitening;53 45 }; 54 46 … … 58 50 smpl_t isonset = 0; 59 51 aubio_pvoc_do (o->pv,input, o->fftgrain); 60 /*61 if (apply_filtering) {62 }63 */64 if (o->apply_adaptive_whitening) {65 aubio_spectral_whitening_do(o->spectral_whitening, o->fftgrain);66 }67 if (o->apply_compression) {68 cvec_logmag(o->fftgrain, o->apply_compression);69 }70 52 aubio_specdesc_do (o->od, o->fftgrain, o->desc); 71 53 aubio_peakpicker_do(o->pp, o->desc, onset); … … 118 100 } 119 101 120 uint_t aubio_onset_set_adaptive_whitening (aubio_onset_t *o, uint_t apply_adaptive_whitening)121 {122 o->apply_adaptive_whitening = apply_adaptive_whitening;123 return AUBIO_OK;124 }125 126 uint_t aubio_onset_get_adaptive_whitening (aubio_onset_t *o)127 {128 return o->apply_adaptive_whitening;129 }130 131 102 uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence) { 132 103 o->silence = silence; … … 239 210 o->desc = new_fvec(1); 240 211 241 o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate); 242 243 aubio_onset_default_parameters (o, onset_mode); 212 /* set some default parameter */ 213 aubio_onset_set_threshold (o, 0.3); 214 aubio_onset_set_delay(o, 4.3 * hop_size); 215 aubio_onset_set_minioi_ms(o, 20.); 216 aubio_onset_set_silence(o, -70.); 244 217 245 218 /* initialize internal variables */ … … 256 229 } 257 230 258 void aubio_onset_default_parameters (aubio_onset_t * o, const char_t * onset_mode)259 {260 /* set some default parameter */261 aubio_onset_set_threshold (o, 0.3);262 aubio_onset_set_delay (o, 4.3 * o->hop_size);263 aubio_onset_set_minioi_ms (o, 50.);264 aubio_onset_set_silence (o, -70.);265 aubio_onset_set_adaptive_whitening (o, 0);266 267 o->apply_compression = 0;268 o->lambda_compression = 1.;269 270 /* method specific optimisations */271 if (strcmp (onset_mode, "energy") == 0) {272 } else if (strcmp (onset_mode, "hfc") == 0 || strcmp (onset_mode, "default") == 0) {273 aubio_onset_set_threshold (o, 0.058);274 o->apply_compression = 1;275 o->lambda_compression = 1.;276 aubio_onset_set_adaptive_whitening (o, 0);277 } else if (strcmp (onset_mode, "complexdomain") == 0278 || strcmp (onset_mode, "complex") == 0) {279 aubio_onset_set_delay (o, 4.6 * o->hop_size);280 aubio_onset_set_threshold (o, 0.15);281 o->apply_compression = 1;282 o->lambda_compression = 1.;283 } else if (strcmp (onset_mode, "phase") == 0) {284 o->apply_compression = 0;285 aubio_onset_set_adaptive_whitening (o, 0);286 } else if (strcmp (onset_mode, "mkl") == 0) {287 aubio_onset_set_threshold (o, 0.05);288 } else if (strcmp (onset_mode, "kl") == 0) {289 aubio_onset_set_threshold (o, 0.35);290 } else if (strcmp (onset_mode, "specflux") == 0) {291 aubio_onset_set_threshold (o, 0.4);292 } else if (strcmp (onset_mode, "specdiff") == 0) {293 } else {294 AUBIO_WRN("onset: unknown spectral descriptor type %s, "295 "using default parameters.\n", onset_mode);296 }297 }298 299 231 void del_aubio_onset (aubio_onset_t *o) 300 232 { 301 del_aubio_spectral_whitening(o->spectral_whitening);302 233 del_aubio_specdesc(o->od); 303 234 del_aubio_peakpicker(o->pp);
Note: See TracChangeset
for help on using the changeset viewer.