Changeset 3e7c408


Ignore:
Timestamp:
Sep 8, 2007, 3:35:50 PM (17 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
3504fd7f
Parents:
e2337ba
Message:

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

Location:
examples
Files:
3 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;
  • examples/utils.c

    re2337ba r3e7c408  
    6464//parameters
    6565uint_t n_filters=20;
    66 uint_t nyquist= samplerate / 2.;
    6766smpl_t lowfreq=80.f;
    6867smpl_t highfreq=18000.f;
    6968// filterbank object
    70 aubio_mel_filter * mf;
     69aubio_filterbank_t * mf;
    7170
    7271// DCT mfft and result storage
    73 aubio_mfft * fft_dct;
     72aubio_mfft_t * fft_dct;
    7473cvec_t * fftgrain_dct;
    75 smpl_t mfcc_outbuf[11];
     74smpl_t * mfcc_outbuf[11];
    7675
    7776
  • examples/utils.h

    re2337ba r3e7c408  
    9898extern aubio_pickpeak_t * parms;
    9999
    100 /* mfcc objects */
    101 // params
    102 extern uint_t n_filters;
    103 extern uint_t nyquist;
    104 extern smpl_t lowfreq;
    105 extern smpl_t highfreq;
    106 // filterbank object
    107 extern aubio_mel_filter * mf;
    108 // DCT pvoc and result storage
    109 extern aubio_mfft_t * fft_dct;
    110 extern cvec_t * fftgrain_dct;
    111 extern smpl_t mfcc_outbuf[20];
    112 
    113100/* pitch objects */
    114101extern smpl_t pitch;
Note: See TracChangeset for help on using the changeset viewer.