Changeset ce6186a


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

Location:
examples
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • examples/aubionotes.c

    rfe6a393a rce6186a  
    5858
    5959  /* curlevel is negatif or 1 if silence */
    60   smpl_t curlevel = aubio_level_detection(ibuf, silence);
     60  smpl_t curlevel = aubio_level_detection(ibuf, silence_threshold);
    6161  if (fvec_read_sample(onset, 0)) {
    6262    /* test for silence */
  • 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
  • examples/aubioquiet.c

    rfe6a393a rce6186a  
    2626void process_block(fvec_t * ibuf, fvec_t * obuf) {
    2727  fvec_zeros (obuf);
    28   if (aubio_silence_detection(ibuf, silence)==1) {
     28  if (aubio_silence_detection(ibuf, silence_threshold)==1) {
    2929    if (wassilence==1) issilence = 1;
    3030    else issilence = 2;
  • 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}
  • examples/parse_args.h

    rfe6a393a rce6186a  
    3838extern char_t * tempo_method;
    3939// more general stuff
    40 extern smpl_t silence;
     40extern smpl_t silence_threshold;
    4141extern uint_t mix_input;
    4242
     
    184184        break;
    185185      case 's':                /* silence threshold */
    186         silence = (smpl_t) atof (optarg);
     186        silence_threshold = (smpl_t) atof (optarg);
    187187        break;
    188188      case 'm':                /* mix_input flag */
  • examples/utils.c

    rfe6a393a rce6186a  
    5151char_t * tempo_method = "default";
    5252// more general stuff
    53 smpl_t silence = -90.;
     53smpl_t silence_threshold = -90.;
    5454uint_t mix_input = 0;
    5555
Note: See TracChangeset for help on using the changeset viewer.