From: Paul Brossier Date: Wed, 21 Oct 2009 13:08:24 +0000 (+0200) Subject: examples/: set threshold as needed X-Git-Tag: bzr2git~89 X-Git-Url: http://git.tremily.us/?p=aubio.git;a=commitdiff_plain;h=40acfbc44e8e02c0d438175a93808c138519ae9e examples/: set threshold as needed --- diff --git a/examples/aubionotes.c b/examples/aubionotes.c index 676985aa..d8473dcf 100644 --- a/examples/aubionotes.c +++ b/examples/aubionotes.c @@ -147,6 +147,7 @@ int main(int argc, char **argv) { 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, diff --git a/examples/aubioonset.c b/examples/aubioonset.c index 2c1a186a..9cd9654c 100644 --- a/examples/aubioonset.c +++ b/examples/aubioonset.c @@ -78,6 +78,7 @@ int main(int argc, char **argv) { 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); diff --git a/examples/aubiotrack.c b/examples/aubiotrack.c index a83f0a26..8e9b84ed 100644 --- a/examples/aubiotrack.c +++ b/examples/aubiotrack.c @@ -83,6 +83,7 @@ int main(int argc, char **argv) { 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); diff --git a/examples/utils.c b/examples/utils.c index 2a648d2d..a9e77a24 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -56,7 +56,7 @@ char_t * pitch_mode = "default"; /* 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 @@ parse_args (int argc, char **argv) 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;