Ignore:
Timestamp:
Nov 17, 2018, 4:36:09 PM (5 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
Children:
62c2d00, a95b386
Parents:
adde1ba (diff), 8eecb9f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'feature/mfccparams'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/spectral/mfcc.c

    radde1ba r2eb52bd  
    5252  fvec_t *output;
    5353#endif
     54  smpl_t scale;
    5455};
    5556
     
    7576  /* filterbank allocation */
    7677  mfcc->fb = new_aubio_filterbank (n_filters, mfcc->win_s);
    77   aubio_filterbank_set_mel_coeffs_slaney (mfcc->fb, samplerate);
     78  if (n_filters == 40)
     79    aubio_filterbank_set_mel_coeffs_slaney (mfcc->fb, samplerate);
     80  else
     81    aubio_filterbank_set_mel_coeffs(mfcc->fb, samplerate,
     82        0, samplerate/2.);
    7883
    7984  /* allocating buffers */
     
    97102  mfcc->output = new_fvec (n_filters);
    98103#endif
     104
     105  mfcc->scale = 1.;
    99106
    100107  return mfcc;
     
    128135  fvec_t tmp;
    129136#endif
     137
    130138  /* compute filterbank */
    131139  aubio_filterbank_do (mf->fb, in, mf->in_dct);
     
    134142  fvec_log10 (mf->in_dct);
    135143
    136   /* raise power */
    137   //fvec_pow (mf->in_dct, 3.);
     144  if (mf->scale != 1) fvec_mul (mf->in_dct, mf->scale);
    138145
    139146  /* compute mfccs */
     
    151158  return;
    152159}
     160
     161uint_t aubio_mfcc_set_power (aubio_mfcc_t *mf, smpl_t power)
     162{
     163  return aubio_filterbank_set_power(mf->fb, power);
     164}
     165
     166uint_t aubio_mfcc_get_power (aubio_mfcc_t *mf)
     167{
     168  return aubio_filterbank_get_power(mf->fb);
     169}
     170
     171uint_t aubio_mfcc_set_scale (aubio_mfcc_t *mf, smpl_t scale)
     172{
     173  mf->scale = scale;
     174  return AUBIO_OK;
     175}
     176
     177uint_t aubio_mfcc_get_scale (aubio_mfcc_t *mf)
     178{
     179  return mf->scale;
     180}
     181
     182uint_t aubio_mfcc_set_mel_coeffs (aubio_mfcc_t *mf, smpl_t freq_min,
     183    smpl_t freq_max)
     184{
     185  return aubio_filterbank_set_mel_coeffs(mf->fb, mf->samplerate,
     186      freq_min, freq_max);
     187}
     188
     189uint_t aubio_mfcc_set_mel_coeffs_htk (aubio_mfcc_t *mf, smpl_t freq_min,
     190    smpl_t freq_max)
     191{
     192  return aubio_filterbank_set_mel_coeffs_htk(mf->fb, mf->samplerate,
     193      freq_min, freq_max);
     194}
     195
     196uint_t aubio_mfcc_set_mel_coeffs_slaney (aubio_mfcc_t *mf)
     197{
     198  return aubio_filterbank_set_mel_coeffs_slaney (mf->fb, mf->samplerate);
     199}
Note: See TracChangeset for help on using the changeset viewer.