shithub: aubio

Download patch

ref: a5597968ec6b5b2f1614b8b56c4c759c44e7e4ac
parent: 9f68f113664ff064949992ff605896be3857986a
author: Paul Brossier <piem@piem.org>
date: Sat Feb 22 18:14:47 EST 2014

src/tempo/tempo.c: novelty function default to specflux

--- a/examples/utils.c
+++ b/examples/utils.c
@@ -48,7 +48,7 @@
 char_t * pitch_method = "default";
 smpl_t pitch_tolerance = 0.0; // will be set if != 0.
 // tempo stuff
-char_t * tempo_method = "specflux";
+char_t * tempo_method = "default";
 // more general stuff
 smpl_t silence_threshold = -90.;
 uint_t mix_input = 0;
--- a/src/tempo/tempo.c
+++ b/src/tempo/tempo.c
@@ -157,10 +157,11 @@
 }
 
 /* Allocate memory for an tempo detection */
-aubio_tempo_t * new_aubio_tempo (char_t * onset_mode, 
+aubio_tempo_t * new_aubio_tempo (char_t * tempo_mode,
     uint_t buf_size, uint_t hop_size, uint_t samplerate)
 {
   aubio_tempo_t * o = AUBIO_NEW(aubio_tempo_t);
+  char_t specdesc_func[20];
   o->samplerate = samplerate;
   /* length of observations, worth about 6 seconds */
   o->winlen = aubio_next_power_of_two(5.8 * samplerate / hop_size);
@@ -178,7 +179,12 @@
   o->pv       = new_aubio_pvoc(buf_size, hop_size);
   o->pp       = new_aubio_peakpicker();
   aubio_peakpicker_set_threshold (o->pp, o->threshold);
-  o->od       = new_aubio_specdesc(onset_mode,buf_size);
+  if ( strcmp(tempo_mode, "default") == 0 ) {
+    strcpy(specdesc_func, "specflux");
+  } else {
+    strcpy(specdesc_func, tempo_mode);
+  }
+  o->od       = new_aubio_specdesc(specdesc_func,buf_size);
   o->of       = new_fvec(1);
   o->bt       = new_aubio_beattracking(o->winlen, o->hop_size, o->samplerate);
   o->onset    = new_fvec(1);