Ignore:
Timestamp:
Sep 8, 2007, 3:35:50 PM (13 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/constantq, feature/pitchshift, feature/pydocstrings, feature/timestretch, master, pitchshift, sampler, timestretch, yinfft+
Children:
3504fd7f
Parents:
e2337ba
Message:

utils.c, utils.h: remove mfcc, move to aubiomfcc.c

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiomfcc.c

    re2337ba r3e7c408  
    1818
    1919#include "utils.h"
     20
     21/* mfcc objects */
     22fvec_t * mfcc_outbuf;
     23aubio_mfcc_t * mfcc;
    2024
    2125unsigned int pos = 0; /*frames%dspblocksize*/
     
    4347      aubio_pvoc_do (pv,ibuf, fftgrain);
    4448     
    45       uint_t n_coefs= n_filters/2 +1;
    46       uint_t coef_cnt;
    47        
    48 
    49       for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++)
    50         mfcc_outbuf[coef_cnt]=0.f;
    51        
    5249      //compute mfccs
    53       aubio_mffc_do(fftgrain->norm, nframes, mf, mfcc_outbuf, fft_dct, fftgrain_dct);
    54      
    55       for (coef_cnt=0; coef_cnt<n_coefs ; coef_cnt++)
    56         outmsg("%f ",mfcc_outbuf[coef_cnt]);
    57       outmsg("\n");
    58      
    59      
     50      aubio_mfcc_do(mfcc, fftgrain, mfcc_outbuf);
    6051
    6152      /* end of block loop */
     
    8374
    8475int main(int argc, char **argv) {
     76  // params
     77  uint_t n_filters = 11;
     78  smpl_t lowfreq = 500.;
     79  smpl_t highfreq = 2000.;
    8580  examples_common_init(argc,argv);
    86  
    87   //allocate and initialize mel filter bank
    88  
    89 
    90   //allocating global mf (in utils.c)
    91   uint_t banksize = (uint) ( sizeof(aubio_mel_filter));
    92   mf = (aubio_mel_filter *)getbytes(banksize);
    93 
    94   mf->n_filters = 20;
    95   mf->filters = (smpl_t **)getbytes(mf->n_filters * sizeof(smpl_t *));
    96   for(n = 0; n < mf->n_filters; n++)
    97     mf->filters[n] = (smpl_t *)getbytes((buffer_size/2+1) * sizeof(smpl_t));
     81  mfcc_outbuf = new_fvec(n_filters,channels);
    9882 
    9983  //populating the filter
    100   aubio_mfcc_init(buffer_size, nyquist, XTRACT_EQUAL_GAIN, lowfreq, highfreq, mf->n_filters, mf->filters);
     84  mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, lowfreq, highfreq,
     85      channels);
    10186
    10287  //process
     
    10691  fflush(stderr);
    10792 
    108   //destroying filterbank
    109   free(mf);
     93  //destroying mfcc
     94  del_aubio_mfcc(mfcc);
     95  del_fvec(mfcc_outbuf);
    11096 
    11197  return 0;
Note: See TracChangeset for help on using the changeset viewer.