Changes in / [45134c5:7a46bf6]


Ignore:
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiomfcc.c

    r45134c5 r7a46bf6  
    2323fvec_t * mfcc_out;
    2424aubio_mfcc_t * mfcc;
     25
     26uint_t n_filters = 20;
     27uint_t n_coefs = 11;
    2528
    2629unsigned int pos = 0; /*frames%dspblocksize*/
     
    6568      */
    6669     
    67       uint_t filter_cnt;
     70      uint_t coef_cnt;
    6871      if (output_filename == NULL) {
    69         if(frames >= 4) {
    70           outmsg("%f\t",(frames-4)*overlap_size/(float)samplerate);
    71         } else if (frames < 4) {
    72           outmsg("%f\t",0.);
     72//         if(frames >= 4) {
     73//           outmsg("%f\t",(frames-4)*overlap_size/(float)samplerate);
     74//         }
     75//         else if (frames < 4) {
     76//           outmsg("%f\t",0.);
     77//         }
     78        //outmsg("%f ",mfcc_out->data[0][0]);
     79       
     80        /*for (coef_cnt = 0; coef_cnt < n_coefs; coef_cnt++) {
     81          outmsg("%f ",mfcc_out->data[0][coef_cnt]);
    7382        }
    74         outmsg("%f",mfcc_out->data[0][0]);
    75         for (filter_cnt = 1; filter_cnt < mfcc_out->length; filter_cnt++) {
    76           outmsg(",%f",mfcc_out->data[0][filter_cnt]);
    77         }
    78         outmsg("\n");
     83        outmsg("\n");/*/
    7984      }
    8085}
     
    8287int main(int argc, char **argv) {
    8388  // params
    84   uint_t n_filters = 11;
     89  //uint_t n_filters = 40;
     90  //uint_t n_coefs = 15;
     91
    8592  examples_common_init(argc,argv);
    86   smpl_t lowfreq = 0.;
    87   smpl_t highfreq = samplerate;
    88   mfcc_out = new_fvec(n_filters,channels);
     93  smpl_t lowfreq = 133.333f;
     94  smpl_t highfreq = 44100.f;
     95  mfcc_out = new_fvec(n_coefs,channels);
    8996 
    9097  //populating the filter
    91   mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, lowfreq, highfreq,
    92       channels);
     98  mfcc = new_aubio_mfcc(buffer_size, samplerate, n_filters, n_coefs , lowfreq, highfreq, channels);
    9399
    94100  //process
  • examples/utils.c

    r45134c5 r7a46bf6  
    6060int isonset = 0;
    6161aubio_pickpeak_t * parms;
    62 
    63 /* mfcc objects */
    64 //parameters
    65 uint_t n_filters=20;
    66 smpl_t lowfreq=80.f;
    67 smpl_t highfreq=18000.f;
    68 // filterbank object
    69 aubio_filterbank_t * mf;
    70 
    71 // DCT mfft and result storage
    72 aubio_mfft_t * fft_dct;
    73 cvec_t * fftgrain_dct;
    74 smpl_t * mfcc_outbuf[11];
    75 
    7662
    7763/* pitch objects */
     
    314300  fftgrain  = new_cvec(buffer_size, channels);
    315301
    316   //init for mfcc process
    317   fftgrain_dct= new_cvec(n_filters, channels);
    318 
     302 
    319303  if (usepitch) {
    320304    pitchdet = new_aubio_pitchdetection(buffer_size*4,
     
    330314  pv = new_aubio_pvoc(buffer_size, overlap_size, channels);
    331315 
    332   // dct phase vocoder
    333   //TODO: check size
    334   fft_dct = new_aubio_mfft(n_filters, channels);
    335 
    336316  /* onsets */
    337317  parms = new_aubio_peakpicker(threshold);
     
    367347  del_fvec(onset);
    368348  del_fvec(woodblock);
    369  
    370   //mffc related
    371   del_aubio_mfft(fft_dct);
    372   del_cvec(fftgrain_dct);
    373349 
    374350  aubio_cleanup();
  • src/filterbank.c

    r45134c5 r7a46bf6  
    2626#include "sample.h"
    2727#include "filterbank.h"
     28
     29#include "stdio.h"
    2830
    2931#define USE_EQUAL_GAIN 1
     
    5456
    5557aubio_filterbank_t * new_aubio_filterbank_mfcc(uint_t n_filters, uint_t win_s, smpl_t samplerate, smpl_t freq_min, smpl_t freq_max){
     58 
     59  uint_t writelog=1;
     60
     61  FILE * mlog;
     62  if(writelog==1) mlog=fopen("filterbank.txt","w");
     63 
     64
    5665  smpl_t nyquist = samplerate/2.;
    5766  uint_t style = 1;
     
    142151    for(k = next_peak + 1; k < fb->win_s; k++)
    143152      fb->filters[n]->data[0][k]=0.f;
     153
     154    if(writelog){
     155      //dumping filter values
     156      smpl_t area_tmp=0.f;
     157      for(k = 0; k < fb->win_s; k++){
     158        fprintf(mlog,"%f ",fb->filters[n]->data[0][k]);
     159      }
     160      fprintf(mlog,"\n");
     161    }
     162
    144163  }
    145164
     
    148167  free(height_norm);
    149168  free(fft_peak);
     169
     170  if(mlog) fclose(mlog);
    150171
    151172  return fb;
  • src/mfcc.c

    r45134c5 r7a46bf6  
    3434  uint_t samplerate;        /** sample rate (needed?) */
    3535  uint_t channels;          /** number of channels */
    36   uint_t n_coefs;           /** number of coefficients (= fb->n_filters/2 +1) */
     36  uint_t n_filters;         /** number of  *filters */
     37  uint_t n_coefs;           /** number of coefficients (<= n_filters/2 +1) */
    3738  smpl_t lowfreq;           /** lowest frequency for filters */
    3839  smpl_t highfreq;          /** highest frequency for filters */
     
    4445
    4546
    46 aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate ,uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels){
     47aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate, uint_t n_filters, uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels){
    4748  /** allocating space for mfcc object */
    4849  aubio_mfcc_t * mfcc = AUBIO_NEW(aubio_mfcc_t);
    4950
    5051  //we need (n_coefs-1)*2 filters to obtain n_coefs coefficients after dct
    51   uint_t n_filters = (n_coefs-1)*2;
     52  //uint_t n_filters = (n_coefs-1)*2;
    5253 
    5354  mfcc->win_s=win_s;
    5455  mfcc->samplerate=samplerate;
    5556  mfcc->channels=channels;
     57  mfcc->n_filters=n_filters;
    5658  mfcc->n_coefs=n_coefs;
    5759  mfcc->lowfreq=lowfreq;
     
    102104    aubio_mfft_do (mf->fft_dct, in, mf->fftgrain_dct);
    103105    //extract real part of fft grain
    104     //for(i=0; i<mf->n_coefs ;i++){
    105     for(i=0; i<out->length;i++){
     106    for(i=0; i<mf->n_coefs ;i++){
     107    //for(i=0; i<out->length;i++){
    106108      out->data[0][i]= mf->fftgrain_dct->norm[0][i]
    107109        *COS(mf->fftgrain_dct->phas[0][i]);
  • src/mfcc.h

    r45134c5 r7a46bf6  
    4545
    4646*/
    47 aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate ,uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels);
     47aubio_mfcc_t * new_aubio_mfcc (uint_t win_s, uint_t samplerate, uint_t n_filters, uint_t n_coefs, smpl_t lowfreq, smpl_t highfreq, uint_t channels);
    4848/** delete mfcc object
    4949
Note: See TracChangeset for help on using the changeset viewer.