shithub: aubio

Download patch

ref: 2062e489d684e82ec7cd5e0994fc39f96b353eb2
parent: 75a0f40927d75377fbab4c5805f05b9c20bd5d84
author: Paul Brossier <piem@piem.org>
date: Wed Sep 23 14:37:24 EDT 2009

src/spectral/filterbank*.c: reduce filterbank size to n/2+1, other half is always empty

--- a/src/spectral/filterbank.c
+++ b/src/spectral/filterbank.c
@@ -44,7 +44,7 @@
   fb->n_filters = n_filters;
 
   /* allocate filter tables, an fvec of length win_s and of filter_cnt channel */
-  fb->filters = new_fvec (win_s, n_filters);
+  fb->filters = new_fvec (win_s / 2 + 1, n_filters);
 
   return fb;
 }
--- a/src/spectral/filterbank_mel.c
+++ b/src/spectral/filterbank_mel.c
@@ -69,7 +69,7 @@
 
   /* fill fft_freqs lookup table, which assigns the frequency in hz to each bin */
   for (bin = 0; bin < win_s; bin++) {
-    fft_freqs->data[0][bin] = aubio_bintofreq (bin, samplerate, win_s);
+    fft_freqs->data[0][bin] = aubio_bintofreq (bin, samplerate, (win_s - 1) * 2);
   }
 
   /* zeroing of all filters */