Ignore:
Timestamp:
Mar 3, 2013, 5:47:05 PM (12 years ago)
Author:
Paul Brossier <piem@piem.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
248da64
Parents:
e230bb4
Message:

tests/src/pitch/: improve examples

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/src/pitch/test-pitchyin.c

    re230bb4 rc71aa44  
    11#define AUBIO_UNSTABLE 1
     2
     3// this file uses the unstable aubio api, please use aubio_pitch instead
     4// see src/pitch/pitch.h and tests/src/pitch/test-pitch.c
    25
    36#include <aubio.h>
    47
    5 int main(){
    6         /* allocate some memory */
    7         uint_t win_s      = 1024;                       /* window size */
    8         fvec_t * in       = new_fvec (win_s); /* input buffer */
    9         fvec_t * out      = new_fvec (win_s/2); /* input buffer */
    10         aubio_pitchyin_t *p = new_aubio_pitchyin (win_s);
    11         uint_t i = 0;
     8int main ()
     9{
     10  uint_t n = 10; // compute n times
     11  uint_t win_s = 1024; // window size
     12  // create some vectors
     13  fvec_t * input_signal = new_fvec (win_s); // input signal
     14  fvec_t * output_cands = new_fvec (1); // output candidates
     15  // create pitch object
     16  aubio_pitchyin_t *p = new_aubio_pitchyin (win_s);
    1217
    13         while (i < 10) {
    14           aubio_pitchyin_do (p, in,out);
    15           i++;
    16         };
     18  while ( n-- ) {
     19    aubio_pitchyin_do (p, input_signal, output_cands);
     20  };
    1721
    18         del_fvec(in);
    19         del_fvec(out);
    20         del_aubio_pitchyin(p);
    21         aubio_cleanup();
     22  fvec_print(output_cands);
    2223
    23         return 0;
     24  del_fvec(input_signal);
     25  del_fvec(output_cands);
     26  del_aubio_pitchyin(p);
     27  aubio_cleanup();
     28
     29  return 0;
    2430}
Note: See TracChangeset for help on using the changeset viewer.