Changeset fe28ff3


Ignore:
Timestamp:
Sep 5, 2007, 9:37:09 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:
71d3bf0
Parents:
88199ce
Message:

minor corrections

Files:
5 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiomfcc.c

    r88199ce rfe28ff3  
    4242      aubio_pvoc_do (pv,ibuf, fftgrain);
    4343     
    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);
    4847     
    4948     
     
    7473int main(int argc, char **argv) {
    7574  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
    7692  examples_common_process(aubio_process,process_print);
    7793  examples_common_del();
    7894  debug("End of program.\n");
    7995  fflush(stderr);
     96 
     97  //destroying filterbank
     98  free(mf);
     99 
    80100  return 0;
    81101}
  • src/aubio.h

    r88199ce rfe28ff3  
    8080#include "onset.h"
    8181#include "tempo.h"
     82#include "mfcc.h"
    8283
    8384#ifdef __cplusplus
  • src/aubiofilterbank.c

    r88199ce rfe28ff3  
    2525// Initialization
    2626
    27 int aubio_mfcc_init(int N, float nyquist, int style, float freq_min, float freq_max, int freq_bands, float **fft_tables){
     27int 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){
    2828
    2929    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,
    3131        freq_bw_mel, *mel_peak, *height_norm, *lin_peak;
    3232
     
    3939    freq_bw_mel = (mel_freq_max - mel_freq_min) / freq_bands;
    4040
    41     mel_peak = (float *)malloc((freq_bands + 2) * sizeof(float));
     41    mel_peak = (smpl_t *)malloc((freq_bands + 2) * sizeof(smpl_t));
    4242    /* +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));
    4444    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));
    4646
    4747    if(mel_peak == NULL || height_norm == NULL ||
  • src/aubiofilterbank.h

    r88199ce rfe28ff3  
    1818   along with this program; if not, write to the Free Software
    1919   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    20 
    2120*/
    2221
    2322#ifndef AUBIOFILTERBANK_H
    24 #include AUBIOFILTERBANK_H
     23#define AUBIOFILTERBANK_H
    2524
    26 #define NYQUIST 22050.f
    2725
    2826// Struct Declaration
     
    3129typedef struct aubio_mel_filter_ {
    3230    int n_filters;
    33     float **filters;
     31    smpl_t **filters;
    3432} aubio_mel_filter;
    3533
     
    4038 * 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
    4139 */
    42 int aubio_mfcc_init(int N, float nyquist, int style, float freq_min, float freq_max, int freq_bands, float **fft_tables);
     40int aubio_mfcc_init(int N, float nyquist, int style, float freq_min, float freq_max, int freq_bands, smpl_t ** fft_tables);
    4341
    4442#endif
  • src/mfcc.h

    r88199ce rfe28ff3  
    2323#ifndef MFCC_H
    2424#define MFCC_H
     25
     26#include "aubiofilterbank.h"
    2527
    2628#define NYQUIST 22050.f
Note: See TracChangeset for help on using the changeset viewer.