int
main (void)
{
  /* allocate some memory */
  uint_t win_s = 512;           /* fft size */
  uint_t n_filters = 40;        /* number of filters */
  cvec_t *in = new_cvec (win_s);      /* input buffer */
  fvec_t *out = new_fvec (win_s);     /* input buffer */
  fmat_t *coeffs = NULL;
  smpl_t samplerate = 16000.;

  /* allocate fft and other memory space */
  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);

  /* assign Mel-frequency coefficients */
  aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);

  coeffs = aubio_filterbank_get_coeffs (o);
  if (coeffs == NULL) {
    return -1;
  }

  //fmat_print (coeffs);

  //fprintf(stderr, "%f\n", fvec_sum(coeffs));

  aubio_filterbank_do (o, in, out);

  del_aubio_filterbank (o);
  del_cvec (in);
  del_fvec (out);
  aubio_cleanup ();

  return 0;
}
Exemple #2
0
void
aubio_mfcc_do (aubio_mfcc_t * mf, cvec_t * in, fvec_t * out)
{
  uint_t j, k;

  /* compute filterbank */
  aubio_filterbank_do (mf->fb, in, mf->in_dct);

  /* compute log10 */
  fvec_log10 (mf->in_dct);

  /* raise power */
  //fvec_pow (mf->in_dct, 3.);

  /* zeros output */
  fvec_zeros(out);

  /* compute discrete cosine transform */
  for (j = 0; j < mf->n_filters; j++) {
    for (k = 0; k < mf->n_coefs; k++) {
      out->data[k] += mf->in_dct->data[j]
          * mf->dct_coeffs->data[j][k];
    }
  }

  return;
}
Exemple #3
0
int
main (void)
{
  /* allocate some memory */
  uint_t win_s = 1024;          /* window size */
  uint_t n_filters = 13;        /* number of filters */
  cvec_t *in = new_cvec (win_s);      /* input buffer */
  fvec_t *out = new_fvec (win_s);     /* input buffer */
  fmat_t *coeffs = NULL;

  /* allocate fft and other memory space */
  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);

  coeffs = aubio_filterbank_get_coeffs (o);
  if (coeffs == NULL) {
    return -1;
  }

  /*
  if (fvec_max (coeffs) != 0.) {
    return -1;
  }

  if (fvec_min (coeffs) != 0.) {
    return -1;
  }
  */

  fmat_print (coeffs);

  aubio_filterbank_do (o, in, out);

  del_aubio_filterbank (o);
  del_cvec (in);
  del_fvec (out);
  aubio_cleanup ();

  return 0;
}
static PyObject * 
Py_filterbank_do(Py_filterbank * self, PyObject * args)
{
  PyObject *input;
  cvec_t *vec;
  fvec_t *out;

  if (!PyArg_ParseTuple (args, "O", &input)) {
    return NULL;
  }

  vec = PyAubio_ArrayToCCvec (input);

  if (vec == NULL) {
    return NULL;
  }

  out = new_fvec (self->n_filters);

  // compute the function
  aubio_filterbank_do (self->o, vec, out);
  return (PyObject *)PyAubio_CFvecToArray(out);
}
Exemple #5
0
int main ()
{
  uint_t win_s = 1024; // window size
  uint_t n_filters = 13; // number of filters

  cvec_t *in_spec = new_cvec (win_s); // input vector of samples
  fvec_t *out_filters = new_fvec (n_filters); // per-band outputs

  // create filterbank object
  aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);

  // apply filterbank ten times
  uint_t n = 10;
  while (n) {
    aubio_filterbank_do (o, in_spec, out_filters);
    n--;
  }

  // print out filterbank coeffs
  fmat_t *coeffs; // pointer to the coefficients
  coeffs = aubio_filterbank_get_coeffs (o);
  fmat_print (coeffs);

  aubio_filterbank_set_coeffs (o, coeffs);
  coeffs = aubio_filterbank_get_coeffs (o);
  fmat_print (coeffs);

  //fvec_print (out_filters);

  // clean up
  del_aubio_filterbank (o);
  del_cvec (in_spec);
  del_fvec (out_filters);
  aubio_cleanup ();

  return 0;
}
int main (void)
{
    uint_t samplerate = 16000; // samplerate of signal to filter
    uint_t win_s = 512; // fft size
    uint_t n_filters = 40; // number of filters

    cvec_t *in_spec = new_cvec (win_s); // input vector of samples
    fvec_t *out_filters = new_fvec (n_filters); // per-band outputs

    // create filterbank object
    aubio_filterbank_t *o = new_aubio_filterbank (n_filters, win_s);

    // assign Mel-frequency coefficients
    aubio_filterbank_set_mel_coeffs_slaney (o, samplerate);

    // apply filterbank ten times
    uint_t n = 10;
    while (n) {
        aubio_filterbank_do (o, in_spec, out_filters);
        n--;
    }

    // print out filter coefficients
    fmat_t *coeffs; // pointer to the coefficients
    coeffs = aubio_filterbank_get_coeffs (o);
    fmat_print (coeffs);

    //fvec_print (out_filters);

    del_aubio_filterbank (o);
    del_cvec (in_spec);
    del_fvec (out_filters);
    aubio_cleanup ();

    return 0;
}
void ofxAubioMelBands::blockAudioIn()
{
    aubio_pvoc_do(pv, aubio_input, spectrum);
    aubio_filterbank_do(fb, spectrum, bands);
}