From: Paul Brossier Date: Sun, 11 Dec 2016 15:49:13 +0000 (+0100) Subject: examples/aubioonset.c: add minioi option, in millisecond X-Git-Tag: 0.4.4~75 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=ab7212f9f0852254b7ea7c76ce95c14f84110947;p=aubio.git examples/aubioonset.c: add minioi option, in millisecond --- diff --git a/examples/aubionotes.c b/examples/aubionotes.c index 36179a92..5d2f3a27 100644 --- a/examples/aubionotes.c +++ b/examples/aubionotes.c @@ -69,6 +69,8 @@ int main(int argc, char **argv) { 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 diff --git a/examples/aubioonset.c b/examples/aubioonset.c index 03bab5b7..c24245dd 100644 --- a/examples/aubioonset.c +++ b/examples/aubioonset.c @@ -74,6 +74,8 @@ int main(int argc, char **argv) { 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); diff --git a/examples/aubiotrack.c b/examples/aubiotrack.c index 787c3080..36267cf6 100644 --- a/examples/aubiotrack.c +++ b/examples/aubiotrack.c @@ -80,6 +80,7 @@ int main(int argc, char **argv) { // 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.); diff --git a/examples/parse_args.h b/examples/parse_args.h index 6a3790bb..fd8e3380 100644 --- a/examples/parse_args.h +++ b/examples/parse_args.h @@ -36,6 +36,7 @@ extern uint_t hop_size; // 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 @@ void usage (FILE * stream, int exit_code) " 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 @@ parse_args (int argc, char **argv) "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 @@ parse_args (int argc, char **argv) #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'}, @@ -227,6 +231,9 @@ parse_args (int argc, char **argv) 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; break; diff --git a/examples/utils.c b/examples/utils.c index dc273867..296c6c36 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -43,6 +43,7 @@ uint_t hop_size = 256; // 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";