Ignore:
Timestamp:
Nov 4, 2013, 3:28:24 PM (11 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:
e97d0b3
Parents:
509e8f9
Message:

examples/: use wavetable to play pitch and to replace woodblock

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiotrack.c

    r509e8f9 rf3617e7  
    1919*/
    2020
    21 #include <aubio.h>
    2221#include "utils.h"
    2322
    2423uint_t pos = 0;    /* frames%dspblocksize */
     24aubio_tempo_t * bt = NULL;
     25aubio_wavetable_t *wavetable;
    2526fvec_t * tempo_out = NULL;
    26 aubio_tempo_t * bt = NULL;
    2727smpl_t istactus = 0;
    2828smpl_t isonset = 0;
     
    3838    }
    3939    /*time for fft*/
    40     if (pos == overlap_size-1) {         
     40    if (pos == overlap_size-1) {
    4141      /* block loop */
    4242      aubio_tempo_do (bt,ibuf,tempo_out);
    4343      istactus = fvec_read_sample (tempo_out, 0);
    4444      isonset = fvec_read_sample (tempo_out, 1);
     45      fvec_zeros (obuf);
    4546      if (istactus > 0.) {
    46         fvec_copy (woodblock, obuf);
     47        aubio_wavetable_play ( wavetable );
    4748      } else {
    48         fvec_zeros (obuf);
     49        aubio_wavetable_stop ( wavetable );
    4950      }
     51      aubio_wavetable_do (wavetable, ibuf, obuf);
    5052      /* end of block loop */
    5153      pos = -1; /* so it will be zero next j loop */
     
    5759
    5860static void process_print (void) {
    59         if (sink_uri == NULL) {
    60                 if (istactus) {
    61                         outmsg("%f\n",((smpl_t)(frames*overlap_size)+(istactus-1.)*overlap_size)/(smpl_t)samplerate);
    62                 }
    63                 if (isonset && verbose)
    64                         outmsg(" \t \t%f\n",(frames)*overlap_size/(float)samplerate);
    65         }
     61  if (sink_uri == NULL) {
     62    if (istactus) {
     63      outmsg("%f\n",((smpl_t)(frames*overlap_size)+(istactus-1.)*overlap_size)/(smpl_t)samplerate);
     64    }
     65    if (isonset && verbose)
     66      outmsg(" \t \t%f\n",(frames)*overlap_size/(float)samplerate);
     67  }
    6668}
    6769
     
    7779  if (threshold != 0.) aubio_tempo_set_threshold (bt, threshold);
    7880
     81  wavetable = new_aubio_wavetable (samplerate, overlap_size);
     82  aubio_wavetable_set_freq ( wavetable, 2450.);
     83  //aubio_sampler_load (sampler, "/archives/sounds/woodblock.aiff");
     84
    7985  examples_common_process(aubio_process,process_print);
    8086
    8187  del_aubio_tempo(bt);
     88  del_aubio_wavetable (wavetable);
    8289  del_fvec(tempo_out);
    8390
Note: See TracChangeset for help on using the changeset viewer.