Changeset 40ed6a7


Ignore:
Timestamp:
Mar 26, 2017, 5:38:09 PM (7 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

Location:
src/onset
Files:
2 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 */
  • src/onset/onset.h

    rfa3edc6 r40ed6a7  
    121121
    122122  \param o onset detection object as returned by new_aubio_onset()
    123   \param apply_adaptive_whitening 1 to enable, 0 to disable
    124 
    125 */
    126 uint_t aubio_onset_set_adaptive_whitening(aubio_onset_t * o, uint_t apply_adaptive_whitening);
    127 
    128 /** get onset detection silence threshold
    129 
    130   \param o onset detection object as returned by new_aubio_onset()
    131 
    132   \return adaptive whitening mode, 1 if enabled, 0 otherwise
    133 
    134 */
    135 uint_t aubio_onset_get_adaptive_whitening(aubio_onset_t * o);
     123  \param enable 1 to enable, 0 to disable
     124
     125  \return 0 if successful, 1 otherwise
     126
     127*/
     128uint_t aubio_onset_set_awhitening(aubio_onset_t * o, uint_t enable);
     129
     130/** get onset detection adaptive whitening
     131
     132  \param o onset detection object as returned by new_aubio_onset()
     133
     134  \return 1 if enabled, 0 otherwise
     135
     136*/
     137smpl_t aubio_onset_get_awhitening(aubio_onset_t * o);
     138
     139/** set or disable log compression
     140
     141  \param o onset detection object as returned by new_aubio_onset()
     142  \param lambda logarithmic compression factor
     143
     144  \return 0 if successful, 1 otherwise
     145
     146 */
     147uint_t aubio_onset_set_logmag_compression(aubio_onset_t *o, smpl_t lambda);
     148
     149/** get onset detection log compression
     150 */
     151smpl_t aubio_onset_get_logmag_compression(aubio_onset_t *o);
    136152
    137153/** set onset detection silence threshold
Note: See TracChangeset for help on using the changeset viewer.