Changeset 40ed6a7 for src/onset/onset.c


Ignore:
Timestamp:
Mar 26, 2017, 5:38:09 PM (8 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, sampler
Children:
b63c7d3
Parents:
fa3edc6
Message:

src/onset/onset.h: rename to awhitening, add logmap_compression

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/onset/onset.c

    rfa3edc6 r40ed6a7  
    4949  uint_t apply_compression;
    5050  smpl_t lambda_compression;
    51   uint_t apply_adaptive_whitening;
     51  uint_t apply_awhitening;      /**< apply adaptive spectral whitening */
    5252  aubio_spectral_whitening_t *spectral_whitening;
    5353};
     
    6262  }
    6363  */
    64   if (o->apply_adaptive_whitening) {
     64  if (o->apply_awhitening) {
    6565    aubio_spectral_whitening_do(o->spectral_whitening, o->fftgrain);
    6666  }
    6767  if (o->apply_compression) {
    68     cvec_logmag(o->fftgrain, o->apply_compression);
     68    cvec_logmag(o->fftgrain, o->lambda_compression);
    6969  }
    7070  aubio_specdesc_do (o->od, o->fftgrain, o->desc);
     
    118118}
    119119
    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;
     120uint_t aubio_onset_set_awhitening (aubio_onset_t *o, uint_t enable)
     121{
     122  o->apply_awhitening = enable == 1 ? 1 : 0;
     123  return AUBIO_OK;
     124}
     125
     126smpl_t aubio_onset_get_awhitening (aubio_onset_t *o)
     127{
     128  return o->apply_awhitening;
     129}
     130
     131uint_t aubio_onset_set_logmag_compression (aubio_onset_t *o, smpl_t lambda)
     132{
     133  if (lambda < 0.) {
     134    return AUBIO_FAIL;
     135  }
     136  o->lambda_compression = lambda;
     137  o->apply_compression = (o->lambda_compression > 0.) ? 1 : 0;
     138  return AUBIO_OK;
     139}
     140
     141smpl_t aubio_onset_get_logmag_compression (aubio_onset_t *o)
     142{
     143  return o->apply_compression ? o->lambda_compression : 0;
    129144}
    130145
     
    267282  aubio_onset_set_minioi_ms (o, 50.);
    268283  aubio_onset_set_silence (o, -70.);
    269   aubio_onset_set_adaptive_whitening (o, 0);
    270 
    271   o->apply_compression = 0;
    272   o->lambda_compression = 1.;
     284  // disable spectral whitening
     285  aubio_onset_set_awhitening (o, 0);
     286  // disable logarithmic magnitude
     287  aubio_onset_set_logmag_compression (o, 0.);
    273288
    274289  /* method specific optimisations */
Note: See TracChangeset for help on using the changeset viewer.