shithub: aubio

Download patch

ref: ab7212f9f0852254b7ea7c76ce95c14f84110947
parent: 1186c982db888488e0426adfdc1b2b128c17421d
author: Paul Brossier <piem@piem.org>
date: Sun Dec 11 11:49:13 EST 2016

examples/aubioonset.c: add minioi option, in millisecond

--- a/examples/aubionotes.c
+++ b/examples/aubionotes.c
@@ -69,6 +69,8 @@
   notes = new_aubio_notes ("default", buffer_size, hop_size, samplerate);
   if (notes == NULL) { ret = 1; goto beach; }
 
+  if (onset_minioi != 0.) errmsg ("warning: minioio not supported yet\n");
+
   examples_common_process((aubio_process_func_t)process_block, process_print);
 
   // send a last note off
--- a/examples/aubioonset.c
+++ b/examples/aubioonset.c
@@ -74,6 +74,8 @@
     aubio_onset_set_threshold (o, onset_threshold);
   if (silence_threshold != -90.)
     aubio_onset_set_silence (o, silence_threshold);
+  if (onset_minioi != 0.)
+    aubio_onset_set_minioi_ms (o, onset_minioi);
 
   onset = new_fvec (1);
 
--- a/examples/aubiotrack.c
+++ b/examples/aubiotrack.c
@@ -80,6 +80,7 @@
   // set silence threshold very low to output beats even during silence
   // aubio_tempo_set_silence(tempo, -1000.);
   if (onset_threshold != 0.) aubio_tempo_set_threshold (tempo, onset_threshold);
+  if (onset_minioi != 0.) errmsg ("warning: minioio not supported yet\n");
 
   wavetable = new_aubio_wavetable (samplerate, hop_size);
   aubio_wavetable_set_freq ( wavetable, 2450.);
--- a/examples/parse_args.h
+++ b/examples/parse_args.h
@@ -36,6 +36,7 @@
 // onset stuff
 extern char_t * onset_method;
 extern smpl_t onset_threshold;
+extern smpl_t onset_minioi;
 // pitch stuff
 extern char_t * pitch_method;
 extern char_t * pitch_unit;
@@ -91,6 +92,8 @@
       "                 default=hfc\n"
       "       -t      --onset-threshold  set onset detection threshold\n"
       "                 a value between 0.1 (more detections) and 1 (less); default=0.3\n"
+      "       -M      --minioi           set minimum inter-onset interval\n"
+      "                 a value in millisecond; default=12.\n"
 #endif /* PROG_HAS_ONSET */
 #ifdef PROG_HAS_PITCH
       "       -p      --pitch            select pitch detection algorithm\n"
@@ -138,7 +141,7 @@
     "o:"
 #endif /* PROG_HAS_OUTPUT */
 #ifdef PROG_HAS_ONSET
-    "O:t:"
+    "O:t:M:"
 #endif /* PROG_HAS_ONSET */
 #ifdef PROG_HAS_PITCH
     "p:u:l:"
@@ -168,6 +171,7 @@
 #ifdef PROG_HAS_ONSET
     {"onset",                 1, NULL, 'O'},
     {"onset-threshold",       1, NULL, 't'},
+    {"onset-minioi",          1, NULL, 'M'},
 #endif /* PROG_HAS_ONSET */
 #ifdef PROG_HAS_PITCH
     {"pitch",                 1, NULL, 'p'},
@@ -226,6 +230,9 @@
         break;
       case 't':                /* threshold value for onset */
         onset_threshold = (smpl_t) atof (optarg);
+        break;
+      case 'M':                /* threshold value for onset */
+        onset_minioi = (smpl_t) atof (optarg);
         break;
       case 'p':
         pitch_method = optarg;
--- a/examples/utils.c
+++ b/examples/utils.c
@@ -43,6 +43,7 @@
 // onset stuff
 char_t * onset_method = "default";
 smpl_t onset_threshold = 0.0; // will be set if != 0.
+smpl_t onset_minioi = 0.0; // will be set if != 0.
 // pitch stuff
 char_t * pitch_unit = "default";
 char_t * pitch_method = "default";