Ignore:
Timestamp:
Dec 8, 2013, 2:14:09 AM (10 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:
3826e0b
Parents:
fe6a393a
Message:

examples/aubio{trac,onset}.c: add silence option

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/aubiotrack.c

    rfe6a393a rce6186a  
    2828aubio_wavetable_t *wavetable;
    2929fvec_t * tempo_out;
    30 smpl_t istactus = 0;
    31 smpl_t isonset = 0;
     30smpl_t is_beat = 0;
     31smpl_t is_onset = 0;
     32uint_t is_silence = 0.;
    3233
    3334void process_block(fvec_t * ibuf, fvec_t *obuf) {
    3435  aubio_tempo_do (tempo, ibuf, tempo_out);
    35   istactus = fvec_read_sample (tempo_out, 0);
    36   isonset = fvec_read_sample (tempo_out, 1);
     36  is_beat = fvec_read_sample (tempo_out, 0);
     37  is_onset = fvec_read_sample (tempo_out, 1);
     38  if (silence_threshold != -90.)
     39    is_silence = aubio_silence_detection(ibuf, silence_threshold);
    3740  fvec_zeros (obuf);
    38   if (istactus > 0.) {
     41  if ( is_beat && !is_silence ) {
    3942    aubio_wavetable_play ( wavetable );
    4043  } else {
     
    4851
    4952void process_print (void) {
    50   if (istactus) {
     53  if ( is_beat && !is_silence ) {
    5154    outmsg("%f\n", aubio_tempo_get_last_s(tempo) );
    5255  }
    53   //if (isonset && verbose)
     56  //if ( is_onset )
    5457  //  outmsg(" \t \t%f\n",(blocks)*hop_size/(float)samplerate);
    5558}
Note: See TracChangeset for help on using the changeset viewer.