shithub: aubio

Download patch

ref: 202ffa5544e0d271747c004cb46f33c1c2a78bed
parent: 74a4865ea20987d9adf612ca88f4c832905fffb8
author: Paul Brossier <piem@piem.org>
date: Sun Oct 11 08:49:49 EDT 2009

src/spectral/mfcc.c: also loop over channels

--- a/src/spectral/mfcc.c
+++ b/src/spectral/mfcc.c
@@ -99,7 +99,7 @@
 void
 aubio_mfcc_do (aubio_mfcc_t * mf, cvec_t * in, fvec_t * out)
 {
-  uint_t i, j;
+  uint_t i, j, k;
 
   /* compute filterbank */
   aubio_filterbank_do (mf->fb, in, mf->in_dct);
@@ -114,10 +114,12 @@
   fvec_zeros(out);
 
   /* compute discrete cosine transform */
-  for (i = 0; i < mf->n_filters; i++) {
-    for (j = 0; j < mf->n_coefs; j++) {
-      out->data[0][j] += mf->in_dct->data[0][i]
-          * mf->dct_coeffs->data[i][j];
+  for (i = 0; i < out->channels; i++) {
+    for (j = 0; j < mf->n_filters; j++) {
+      for (k = 0; k < mf->n_coefs; k++) {
+        out->data[i][k] += mf->in_dct->data[i][j]
+            * mf->dct_coeffs->data[j][k];
+      }
     }
   }