Changeset 7c6c806d for src/mfcc.c


Ignore:
Timestamp:
Sep 6, 2007, 7:32:13 PM (17 years ago)
Author:
Amaury Hazan <mahmoudax@gmail.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:
7a46bf6, fdf39ba
Parents:
71b1b4b
Message:

minor changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mfcc.c

    r71b1b4b r7c6c806d  
    2121*/
    2222
     23#include "aubio_priv.h"
     24#include "sample.h"
     25#include "fft.h"
     26#include "mfcc.h"
     27#include "math.h"
    2328
    24 #include "mffc.h"
     29/*
     30new_aubio_mfcc
     31aubio_mfcc_do
     32del_aubio_mfcc
     33*/
    2534
    2635// Computation
     36// Added last two arguments to be able to pass from example
    2737
    28 int aubio_mfcc_do(const float *data, const int N, const void *argv, float *result){
     38
     39
     40int aubio_mfcc_do(const float *data, const int N, const void *argv, float *result, aubio_mfft_t * fft_dct, cvec_t * fftgrain_dct){
    2941
    3042    aubio_mel_filter *f;
     
    3850            result[filter] += data[n] * f->filters[filter][n];
    3951        }
    40         result[filter] = log(result[filter] < XTRACT_LOG_LIMIT ? XTRACT_LOG_LIMIT : result[filter]);
     52        result[filter] = LOG(result[filter] < XTRACT_LOG_LIMIT ? XTRACT_LOG_LIMIT : result[filter]);
    4153    }
    4254
    43     //TODO: check that zero padding
     55    //TODO: check that zero padding 
    4456    for(n = filter + 1; n < N; n++) result[n] = 0;
    4557   
    46     aubio_dct_do(result, f->n_filters, NULL, result);
     58    aubio_dct_do(result, f->n_filters, NULL, result, fft_dct, fftgrain_dct);
    4759   
    4860    return XTRACT_SUCCESS;
    4961}
    5062
    51 int aubio_dct_do(const float *data, const int N, const void *argv, float *result){
     63// Added last two arguments to be able to pass from example
     64
     65int aubio_dct_do(const float *data, const int N, const void *argv, float *result, aubio_mfft_t * fft_dct, cvec_t * fftgrain_dct){
    5266   
    5367   
     
    5670    //TODO: fvec as input? Remove data length, N?
    5771
     72    fvec_t * momo = new_fvec(20, 1);
     73    momo->data = data;
     74   
    5875    //compute mag spectrum
    59     aubio_pvoc_do (pv,data, fftgrain);
     76    aubio_mfft_do (fft_dct, data, fftgrain_dct);
    6077
    6178    int i;
    6279    //extract real part of fft grain
    6380    for(i=0; i<N ;i++){
    64       result[i]= fftgrain->norm[i]*cos(fftgrain->phase[i]);
     81      result[i]= fftgrain_dct->norm[0][i]*COS(fftgrain_dct->phas[0][i]);
    6582    }
    66    
    67     /*
    68     fftwf_plan plan;
    69    
    70     plan =
    71         fftwf_plan_r2r_1d(N, (float *) data, result, FFTW_REDFT00, FFTW_ESTIMATE);
    72    
    73     fftwf_execute(plan);
    74     fftwf_destroy_plan(plan);*/
     83
    7584
    7685    return XTRACT_SUCCESS;
Note: See TracChangeset for help on using the changeset viewer.