source: tests/src/io/test-source_sndfile.c @ 7839c61

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

tests/src/io/test-source_sndfile.c: test resampling

  • Property mode set to 100644
File size: 775 bytes
Line 
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 = 32000;
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.