Changeset fe28ff3
- Timestamp:
- Sep 5, 2007, 9:37:09 PM (17 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 71d3bf0
- Parents:
- 88199ce
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
examples/aubiomfcc.c
r88199ce rfe28ff3 42 42 aubio_pvoc_do (pv,ibuf, fftgrain); 43 43 44 //TODO: extract Magnitude buffer f_fvec from fftgrain cvec 45 46 //compute mfccs 47 aubio_mffc_do (magbuf, nframes, filterbank, outbuf); 44 45 //compute mfcics 46 aubio_mffc_do(fftgrain->norm, nframes, filterbank, outbuf); 48 47 49 48 … … 74 73 int main(int argc, char **argv) { 75 74 examples_common_init(argc,argv); 75 76 //allocate and initialize mel filter bank 77 uint_t n_filters=20; 78 uint_t nyquist= samplerate / 2.; 79 80 uint_t banksize = (uint) ( sizeof(aubio_mel_filter)); 81 aubio_mel_filter * mf = (aubio_mel_filter *)getbytes(banksize); 82 83 mfilterbank->n_filters = 20; 84 mfilterbank->filters = (smpl_t **)getbytes(mf->n_filters * sizeof(smpl_t *)); 85 for(n = 0; n < mf->n_filters; n++) 86 mf->filters[n] = (smpl_t *)getbytes((buffer_size/2+1) * sizeof(smpl_t)); 87 88 //populating the filter 89 new_aubio_mfcc(buffer_size, nyquist, XTRACT_EQUAL_GAIN, 80.0f, 18000.0f, mf->n_filters, mf->filters); 90 91 //process 76 92 examples_common_process(aubio_process,process_print); 77 93 examples_common_del(); 78 94 debug("End of program.\n"); 79 95 fflush(stderr); 96 97 //destroying filterbank 98 free(mf); 99 80 100 return 0; 81 101 } -
src/aubio.h
r88199ce rfe28ff3 80 80 #include "onset.h" 81 81 #include "tempo.h" 82 #include "mfcc.h" 82 83 83 84 #ifdef __cplusplus -
src/aubiofilterbank.c
r88199ce rfe28ff3 25 25 // Initialization 26 26 27 int aubio_mfcc_init(int N, float nyquist, int style, float freq_min, float freq_max, int freq_bands, float **fft_tables){27 int aubio_mfcc_init(int N, smpl_t nyquist, int style, smpl_t freq_min, smpl_t freq_max, int freq_bands, smpl_t **fft_tables){ 28 28 29 29 int n, i, k, *fft_peak, M, next_peak; 30 float norm, mel_freq_max, mel_freq_min, norm_fact, height, inc, val,30 smpl_t norm, mel_freq_max, mel_freq_min, norm_fact, height, inc, val, 31 31 freq_bw_mel, *mel_peak, *height_norm, *lin_peak; 32 32 … … 39 39 freq_bw_mel = (mel_freq_max - mel_freq_min) / freq_bands; 40 40 41 mel_peak = ( float *)malloc((freq_bands + 2) * sizeof(float));41 mel_peak = (smpl_t *)malloc((freq_bands + 2) * sizeof(smpl_t)); 42 42 /* +2 for zeros at start and end */ 43 lin_peak = ( float *)malloc((freq_bands + 2) * sizeof(float));43 lin_peak = (smpl_t *)malloc((freq_bands + 2) * sizeof(smpl_t)); 44 44 fft_peak = (int *)malloc((freq_bands + 2) * sizeof(int)); 45 height_norm = ( float *)malloc(freq_bands * sizeof(float));45 height_norm = (smpl_t *)malloc(freq_bands * sizeof(smpl_t)); 46 46 47 47 if(mel_peak == NULL || height_norm == NULL || -
src/aubiofilterbank.h
r88199ce rfe28ff3 18 18 along with this program; if not, write to the Free Software 19 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 20 21 20 */ 22 21 23 22 #ifndef AUBIOFILTERBANK_H 24 # include AUBIOFILTERBANK_H23 #define AUBIOFILTERBANK_H 25 24 26 #define NYQUIST 22050.f27 25 28 26 // Struct Declaration … … 31 29 typedef struct aubio_mel_filter_ { 32 30 int n_filters; 33 float **filters;31 smpl_t **filters; 34 32 } aubio_mel_filter; 35 33 … … 40 38 * It is up to the caller to pass in a pointer to memory allocated for freq_bands arrays of length N. This function populates these arrays with magnitude coefficients representing the mel filterbank on a linear scale 41 39 */ 42 int aubio_mfcc_init(int N, float nyquist, int style, float freq_min, float freq_max, int freq_bands, float **fft_tables);40 int aubio_mfcc_init(int N, float nyquist, int style, float freq_min, float freq_max, int freq_bands, smpl_t ** fft_tables); 43 41 44 42 #endif -
src/mfcc.h
r88199ce rfe28ff3 23 23 #ifndef MFCC_H 24 24 #define MFCC_H 25 26 #include "aubiofilterbank.h" 25 27 26 28 #define NYQUIST 22050.f
Note: See TracChangeset
for help on using the changeset viewer.