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
  • TabularUnified tests/src/pitch/test-pitchmcomb.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         uint_t hop_s      = win_s/4;                    /* hop size */
    9         cvec_t * in       = new_cvec (win_s); /* input buffer */
    10         fvec_t * out      = new_fvec (1); /* input buffer */
     8int main ()
     9{
     10  uint_t n = 10; // compute n times
     11  uint_t win_s = 1024; // window size
     12  uint_t hop_s = win_s/4; // hop size
     13  // create some vectors
     14  cvec_t * in_cvec = new_cvec (win_s); // input fftgrain
     15  fvec_t * out_cands = new_fvec (1); // pitch candidate
     16  // create pitch object
     17  aubio_pitchmcomb_t * mcomb = new_aubio_pitchmcomb(win_s, hop_s);
    1118
    12         aubio_pitchmcomb_t * o  = new_aubio_pitchmcomb(win_s, hop_s);
    13         uint_t i = 0;
     19  while ( n-- ) {
     20    aubio_pitchmcomb_do (mcomb, in_cvec, out_cands);
     21    // fvec_print(out_cands);
     22  };
    1423
    15         while (i < 1000) {
    16           aubio_pitchmcomb_do (o,in, out);
    17           i++;
    18         };
     24  // clean up before exiting
     25  del_aubio_pitchmcomb(mcomb);
     26  del_cvec(in_cvec);
     27  del_fvec(out_cands);
    1928
    20         del_aubio_pitchmcomb(o);
    21         del_cvec(in);
    22         del_fvec(out);
    23         aubio_cleanup();
     29  aubio_cleanup();
    2430
    25         return 0;
     31  return 0;
    2632}
Note: See TracChangeset for help on using the changeset viewer.