shithub: aubio

ref: 2ba3440468478fdaaf5b4fbc11e7103d54f7500e
dir: /tests/src/test-onsetdetection.c/

View raw version

#include <aubio.h>

int
main ()
{
  uint_t win_s = 1024;          /* window size */
  uint_t channels = 1;          /* number of channel */
  cvec_t *in = new_cvec (win_s, channels);      /* input buffer */
  fvec_t *out = new_fvec (1, channels); /* input buffer */

  aubio_onsetdetection_t *o;
  
  o = new_aubio_onsetdetection (aubio_onset_energy, win_s, channels);
  aubio_onsetdetection_do (o, in, out);
  del_aubio_onsetdetection (o);

  o = new_aubio_onsetdetection (aubio_onset_specdiff, win_s, channels);
  aubio_onsetdetection_do (o, in, out);
  del_aubio_onsetdetection (o);

  o = new_aubio_onsetdetection (aubio_onset_hfc, win_s, channels);
  aubio_onsetdetection_do (o, in, out);
  del_aubio_onsetdetection (o);

  o = new_aubio_onsetdetection (aubio_onset_complex, win_s, channels);
  aubio_onsetdetection_do (o, in, out);
  del_aubio_onsetdetection (o);

  o = new_aubio_onsetdetection (aubio_onset_phase, win_s, channels);
  aubio_onsetdetection_do (o, in, out);
  del_aubio_onsetdetection (o);

  o = new_aubio_onsetdetection (aubio_onset_kl, win_s, channels);
  aubio_onsetdetection_do (o, in, out);
  del_aubio_onsetdetection (o);

  o = new_aubio_onsetdetection (aubio_onset_mkl, win_s, channels);
  aubio_onsetdetection_do (o, in, out);
  del_aubio_onsetdetection (o);

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

  return 0;
}