shithub: aubio

Download patch

ref: d37400c106cac10492ba20c10ab62a7e42b00280
parent: fd6b90f306465ae305ebf0f2b2ee1d8a1418c744
author: Paul Brossier <piem@piem.org>
date: Mon Sep 28 17:19:40 EDT 2009

src/spectral/filterbank.c: move log10 to mfcc.c

--- a/src/spectral/filterbank.c
+++ b/src/spectral/filterbank.c
@@ -25,8 +25,6 @@
 #include "spectral/filterbank.h"
 #include "mathutils.h"
 
-#define VERY_SMALL_NUMBER 2e-42
-
 /** \brief A structure to store a set of n_filters filters of lenghts win_s */
 struct aubio_filterbank_t_
 {
@@ -78,12 +76,6 @@
       for (j = 0; j < in->length; j++) {
         out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j];
       }
-
-      /* threshold to VERY_SMALL_NUMBER to avoid log oveflow */
-      out->data[i][fn] = MAX (VERY_SMALL_NUMBER, out->data[i][fn]);
-
-      /* compute logarithm */
-      out->data[i][fn] = LOG10 (out->data[i][fn]);
     }
   }
 
--- a/src/spectral/mfcc.c
+++ b/src/spectral/mfcc.c
@@ -22,6 +22,7 @@
 #include "aubio_priv.h"
 #include "fvec.h"
 #include "cvec.h"
+#include "mathutils.h"
 #include "spectral/fft.h"
 #include "spectral/filterbank_mel.h"
 #include "spectral/mfcc.h"
@@ -100,6 +101,12 @@
 
   /* compute filterbank */
   aubio_filterbank_do (mf->fb, in, mf->in_dct);
+
+  /* compute log10 */
+  fvec_log10 (mf->in_dct);
+
+  /* raise power */
+  //vec_pow (mf->in_dct, 3.);
 
   /* zeros output */
   fvec_zeros(out);