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

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • examples/aubioonset.c

    rfe6a393a rce6186a  
    2828aubio_wavetable_t *wavetable;
    2929fvec_t *onset;
     30smpl_t is_onset;
     31uint_t is_silence = 0.;
    3032
    3133void
     
    3335  fvec_zeros(obuf);
    3436  aubio_onset_do (o, ibuf, onset);
    35   if ( fvec_read_sample(onset, 0) ) {
     37  if (silence_threshold != -90.)
     38    is_silence = aubio_silence_detection(ibuf, silence_threshold);
     39  is_onset = fvec_read_sample(onset, 0);
     40  if ( is_onset && !is_silence ) {
    3641    aubio_wavetable_play ( wavetable );
    3742  } else {
     
    4752process_print (void)
    4853{
    49   smpl_t onset_found = fvec_read_sample (onset, 0);
    50   if (onset_found) {
     54  if ( is_onset && !is_silence ) {
    5155    outmsg ("%f\n", aubio_onset_get_last_s (o) );
    5256  }
     
    6064  verbmsg ("buffer_size: %d, ", buffer_size);
    6165  verbmsg ("hop_size: %d, ", hop_size);
     66  verbmsg ("threshold: %f, ", silence_threshold);
    6267  verbmsg ("threshold: %f\n", onset_threshold);
    6368
Note: See TracChangeset for help on using the changeset viewer.