Changes in src/onset/onset.c [078dad8:6352034]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/onset/onset.c
r078dad8 r6352034 24 24 #include "spectral/specdesc.h" 25 25 #include "spectral/phasevoc.h" 26 #include "spectral/awhitening.h" 26 27 #include "onset/peakpicker.h" 27 28 #include "mathutils.h" 28 29 #include "onset/onset.h" 30 31 void aubio_onset_default_parameters (aubio_onset_t *o, const char_t * method); 29 32 30 33 /** structure to store object state */ … … 43 46 uint_t total_frames; /**< total number of frames processed since the beginning */ 44 47 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; 45 53 }; 46 54 … … 50 58 smpl_t isonset = 0; 51 59 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 } 52 70 aubio_specdesc_do (o->od, o->fftgrain, o->desc); 53 71 aubio_peakpicker_do(o->pp, o->desc, onset); … … 100 118 } 101 119 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 102 131 uint_t aubio_onset_set_silence(aubio_onset_t * o, smpl_t silence) { 103 132 o->silence = silence; … … 210 239 o->desc = new_fvec(1); 211 240 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.); 241 o->spectral_whitening = new_aubio_spectral_whitening(buf_size, hop_size, samplerate); 242 243 aubio_onset_default_parameters (o, onset_mode); 217 244 218 245 /* initialize internal variables */ … … 229 256 } 230 257 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") == 0 278 || 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 231 299 void del_aubio_onset (aubio_onset_t *o) 232 300 { 301 del_aubio_spectral_whitening(o->spectral_whitening); 233 302 del_aubio_specdesc(o->od); 234 303 del_aubio_peakpicker(o->pp);
Note: See TracChangeset
for help on using the changeset viewer.