source: tests/src/io/test-source_sndfile.c @ 420962e

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 420962e was afbd7e7, checked in by Paul Brossier <piem@piem.org>, 12 years ago

src/io/source_sndfile.{c,h}: added sndfile source

  • Property mode set to 100644
File size: 775 bytes
RevLine 
[afbd7e7]1#include <stdio.h>
2#include <aubio.h>
3#include "config.h"
4
5char_t *path = "/home/piem/archives/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
6
7int main(){
8#ifdef HAVE_SNDFILE
9  uint_t samplerate = 44100;
10  uint_t hop_size = 512;
11  uint_t read = hop_size;
12  fvec_t *vec = new_fvec(hop_size);
13  aubio_source_sndfile_t * s = new_aubio_source_sndfile(path, samplerate, hop_size);
14
15  if (!s) return -1;
16
17  while ( read == hop_size ) {
18    aubio_source_sndfile_do(s, vec, &read);
19    if (read == 0) break;
20    fprintf(stdout, "%d [%f, %f, ..., %f]\n", read, vec->data[0], vec->data[1], vec->data[read - 1]);
21  }
22
23  del_aubio_source_sndfile(s);
24#else
25  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n");
26#endif /* HAVE_SNDFILE */
27  return 0;
28}
29
Note: See TracBrowser for help on using the repository browser.