shithub: aubio

Download patch

ref: d66d2ac3f386467f0da5809224c973c74b8533f0
parent: d8eedfa0f9e67a63c14e8711d24c4569e40a406f
author: Paul Brossier <piem@piem.org>
date: Sat Nov 17 09:59:54 EST 2018

[mfcc] remove note about power, add scale

--- a/src/spectral/mfcc.c
+++ b/src/spectral/mfcc.c
@@ -51,6 +51,7 @@
   aubio_dct_t *dct;
   fvec_t *output;
 #endif
+  smpl_t scale;
 };
 
 
@@ -97,6 +98,8 @@
   mfcc->output = new_fvec (n_filters);
 #endif
 
+  mfcc->scale = 1.;
+
   return mfcc;
 }
 
@@ -127,6 +130,7 @@
 #ifndef HAVE_SLOW_DCT
   fvec_t tmp;
 #endif
+
   /* compute filterbank */
   aubio_filterbank_do (mf->fb, in, mf->in_dct);
 
@@ -133,8 +137,7 @@
   /* compute log10 */
   fvec_log10 (mf->in_dct);
 
-  /* raise power */
-  //fvec_pow (mf->in_dct, 3.);
+  if (mf->scale != 1) fvec_mul (mf->in_dct, mf->scale);
 
   /* compute mfccs */
 #if defined(HAVE_SLOW_DCT)
@@ -159,6 +162,17 @@
 uint_t aubio_mfcc_get_power (aubio_mfcc_t *mf)
 {
   return aubio_filterbank_get_power(mf->fb);
+}
+
+uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale)
+{
+  mf->scale = scale;
+  return AUBIO_OK;
+}
+
+uint_t aubio_mfcc_get_scale (aubio_mfcc_t *mf)
+{
+  return mf->scale;
 }
 
 uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf, smpl_t freq_min,