shithub: aubio

Download patch

ref: 40acfbc44e8e02c0d438175a93808c138519ae9e
parent: 1c190d586b926e2ffd3aa78e8aef822fdc995163
author: Paul Brossier <piem@piem.org>
date: Wed Oct 21 11:08:24 EDT 2009

examples/: set threshold as needed

--- a/examples/aubionotes.c
+++ b/examples/aubionotes.c
@@ -147,6 +147,7 @@
 
   o = new_aubio_onset (onset_mode, buffer_size, overlap_size, channels,
           samplerate);
+  if (threshold != 0.) aubio_onset_set_threshold (o, threshold);
   onset = new_fvec (1, channels);
 
   pitchdet = new_aubio_pitch (pitch_mode, buffer_size * 4,
--- a/examples/aubioonset.c
+++ b/examples/aubioonset.c
@@ -78,6 +78,7 @@
 
   o = new_aubio_onset (onset_mode, buffer_size, overlap_size, channels,
           samplerate);
+  if (threshold != 0.) aubio_onset_set_threshold (o, threshold);
   onset = new_fvec (1, channels);
 
   examples_common_process(aubio_process,process_print);
--- a/examples/aubiotrack.c
+++ b/examples/aubiotrack.c
@@ -83,6 +83,7 @@
 
   tempo_out = new_fvec(2,channels);
   bt = new_aubio_tempo(onset_mode,buffer_size,overlap_size,channels, samplerate);
+  if (threshold != 0.) aubio_tempo_set_threshold (bt, threshold);
 
   examples_common_process(aubio_process,process_print);
 
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -56,7 +56,7 @@
 
 /* energy,specdiff,hfc,complexdomain,phase */
 char_t * onset_mode = "default";
-smpl_t threshold = 0.3;
+smpl_t threshold = 0.0;         // leave unset, only set as asked 
 smpl_t silence = -90.;
 uint_t buffer_size = 512;       //1024;
 uint_t overlap_size = 256;      //512;
@@ -148,17 +148,11 @@
       case 'O':                /*onset type */
         onset_mode = optarg;
         break;
-      case 's':                /* threshold value for onset */
+      case 's':                /* silence value for onset */
         silence = (smpl_t) atof (optarg);
         break;
       case 't':                /* threshold value for onset */
         threshold = (smpl_t) atof (optarg);
-        /*
-           if (!isfinite(threshold)) {
-           debug("could not get threshold.\n");
-           abort();
-           }
-         */
         break;
       case 'p':
         pitch_mode = optarg;