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

feature/autosinkfeature/constantqfeature/pitchshiftfeature/pydocstringsfeature/timestretchpitchshiftsamplertimestretchyinfft+
Last change on this file since c71aa44 was 2ea7a10, checked in by Paul Brossier <piem@piem.org>, 8 years ago

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

  • Property mode set to 100644
File size: 854 bytes
RevLine 
[afbd7e7]1#include <stdio.h>
2#include <aubio.h>
3#include "config.h"
4
[ab7d100]5char_t *path = "/home/piem/archives/samples/loops/drum_Chocolate_Milk_-_Ation_Speaks_Louder_Than_Words.wav";
[afbd7e7]6
7int main(){
[ab7d100]8  int err = 0;
[afbd7e7]9#ifdef HAVE_SNDFILE
[2ea7a10]10  uint_t samplerate = 8000;
[afbd7e7]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
[ab7d100]16  if (!s) { err = 1; goto beach; }
[afbd7e7]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
[ab7d100]24beach:
[afbd7e7]25  del_aubio_source_sndfile(s);
[ab7d100]26  del_fvec(vec);
[afbd7e7]27#else
28  fprintf(stderr, "ERR: aubio was not compiled with aubio_source_sndfile\n");
[ab7d100]29  err = 2;
[afbd7e7]30#endif /* HAVE_SNDFILE */
[ab7d100]31  return err;
[afbd7e7]32}
33
Note: See TracBrowser for help on using the repository browser.