src/tempo/tempo.c: novelty function default to specflux
authorPaul Brossier <piem@piem.org>
Sun, 23 Feb 2014 02:14:47 +0000 (23:14 -0300)
committerPaul Brossier <piem@piem.org>
Sun, 23 Feb 2014 02:14:47 +0000 (23:14 -0300)
examples/utils.c
src/tempo/tempo.c

index 2592c2d..eba664b 100644 (file)
@@ -48,7 +48,7 @@ char_t * pitch_unit = "default";
 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;
index cfe7d62..821dce7 100644 (file)
@@ -157,10 +157,11 @@ uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold) {
 }
 
 /* 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 @@ aubio_tempo_t * new_aubio_tempo (char_t * onset_mode,
   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);