filterbank.{c,h}: add aubio_filterbank_get_channel function
authorPaul Brossier <piem@piem.org>
Sun, 16 Sep 2007 22:50:05 +0000 (00:50 +0200)
committerPaul Brossier <piem@piem.org>
Sun, 16 Sep 2007 22:50:05 +0000 (00:50 +0200)
src/filterbank.c
src/filterbank.h

index fd1c5a2fb7c0a5d403c38c3aa2eecb0a9d851a79..30c2942c1f004264ccd720e992175015c58b8658 100644 (file)
@@ -22,6 +22,7 @@
 #include "aubio_priv.h"
 #include "sample.h"
 #include "filterbank.h"
+#include "mathutils.h"
 
 #include "stdio.h"
 
@@ -124,8 +125,7 @@ aubio_filterbank_t * new_aubio_filterbank_mfcc(uint_t n_filters, uint_t win_s, u
 
   //filling the fft_freqs lookup table, which assigns the frequency in hz to each bin
   for(bin_cnt=0; bin_cnt<win_s; bin_cnt++){
-    //TODO: check the formula!
-    fft_freqs->data[0][bin_cnt]= (smpl_t)samplerate* (smpl_t)bin_cnt/ (smpl_t)win_s;
+    fft_freqs->data[0][bin_cnt]= aubio_bintofreq(bin_cnt, samplerate, win_s);
   }
 
   //building each filter table
@@ -214,3 +214,8 @@ void aubio_filterbank_do(aubio_filterbank_t * f, cvec_t * in, fvec_t *out) {
 
   return;
 }
+
+fvec_t * aubio_filterbank_getchannel(aubio_filterbank_t * f, uint_t channel) {
+  if ( (channel >= 0) && (channel < f->n_filters) ) { return f->filters[channel]; }
+  else { return NULL; }
+}
index 5b64a5b62875cd952b8a8989a434331ae38cb94a..feed08d35a823b0d3b476c62f05c5be86bfe143e 100644 (file)
@@ -67,6 +67,11 @@ void del_aubio_filterbank(aubio_filterbank_t * fb);
 */
 void aubio_filterbank_do(aubio_filterbank_t * fb, cvec_t * in, fvec_t *out);
 
+/** return the vector containing the filter coefficients of one channel
+
+ */
+fvec_t * aubio_filterbank_getchannel(aubio_filterbank_t * f, uint_t channel);
+
 #ifdef __cplusplus
 }
 #endif