source: tests/src/io/test-source_sndfile.c @ 8f68dfb

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

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

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