From 17961b046446f15bb173c3800e08297066319b74 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Mon, 17 Sep 2007 00:50:05 +0200 Subject: [PATCH] filterbank.{c,h}: add aubio_filterbank_get_channel function --- src/filterbank.c | 9 +++++++-- src/filterbank.h | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/filterbank.c b/src/filterbank.c index fd1c5a2f..30c2942c 100644 --- a/src/filterbank.c +++ b/src/filterbank.c @@ -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_cntdata[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; } +} diff --git a/src/filterbank.h b/src/filterbank.h index 5b64a5b6..feed08d3 100644 --- a/src/filterbank.h +++ b/src/filterbank.h @@ -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 -- 2.26.2