shithub: aubio

Download patch

ref: 340f5c704fb8bd76e7585723df8e634067e9f892
parent: b63c7d39b93d044178d20a2c54dd54d12cd45489
author: Paul Brossier <piem@piem.org>
date: Sun Mar 26 13:45:07 EDT 2017

src/onset/onset.h: rename logmag_compression to compression

--- a/src/onset/onset.c
+++ b/src/onset/onset.c
@@ -128,7 +128,7 @@
   return o->apply_awhitening;
 }
 
-uint_t aubio_onset_set_logmag_compression (aubio_onset_t *o, smpl_t lambda)
+uint_t aubio_onset_set_compression (aubio_onset_t *o, smpl_t lambda)
 {
   if (lambda < 0.) {
     return AUBIO_FAIL;
@@ -138,7 +138,7 @@
   return AUBIO_OK;
 }
 
-smpl_t aubio_onset_get_logmag_compression (aubio_onset_t *o)
+smpl_t aubio_onset_get_compression (aubio_onset_t *o)
 {
   return o->apply_compression ? o->lambda_compression : 0;
 }
@@ -284,15 +284,13 @@
   // disable spectral whitening
   aubio_onset_set_awhitening (o, 0);
   // disable logarithmic magnitude
-  aubio_onset_set_logmag_compression (o, 0.);
+  aubio_onset_set_compression (o, 0.);
 
   /* 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);
+    aubio_onset_set_compression (o, 1.);
   } else if (strcmp (onset_mode, "complexdomain") == 0
              || strcmp (onset_mode, "complex") == 0) {
     aubio_onset_set_delay (o, 4.6 * o->hop_size);
--- a/src/onset/onset.h
+++ b/src/onset/onset.h
@@ -139,16 +139,21 @@
 /** set or disable log compression
 
   \param o onset detection object as returned by new_aubio_onset()
-  \param lambda logarithmic compression factor
+  \param lambda logarithmic compression factor, 0 to disable
 
   \return 0 if successful, 1 otherwise
 
  */
-uint_t aubio_onset_set_logmag_compression(aubio_onset_t *o, smpl_t lambda);
+uint_t aubio_onset_set_compression(aubio_onset_t *o, smpl_t lambda);
 
 /** get onset detection log compression
+
+  \param o onset detection object as returned by new_aubio_onset()
+
+  \returns 0 if disabled, compression factor otherwise
+
  */
-smpl_t aubio_onset_get_logmag_compression(aubio_onset_t *o);
+smpl_t aubio_onset_get_compression(aubio_onset_t *o);
 
 /** set onset detection silence threshold