shithub: aubio

Download patch

ref: 2823389835532f2cf2e9f78ffc9f71dad8a8e435
parent: 6b00c4a2f5c19ac086beee726a574ad91565940d
author: Paul Brossier <piem@piem.org>
date: Thu Oct 17 08:59:19 EDT 2013

src/tempo/beattracking.c: do nothing if period is zero

--- a/src/tempo/beattracking.c
+++ b/src/tempo/beattracking.c
@@ -182,6 +182,10 @@
   bp = bt->bp;
   /* end of biased filterbank */
 
+  if (bp == 0) {
+    output->data[0] = 0;
+    return;
+  }
 
   /* deliberate integer operation, could be set to 3 max eventually */
   kmax = FLOOR (winlen / bp);
@@ -381,7 +385,7 @@
   /* do some further checks on the final bp value */
 
   /* if tempo is > 206 bpm, half it */
-  while (bp < 25) {
+  while (0 < bp && bp < 25) {
 #if AUBIO_BEAT_WARNINGS
     AUBIO_WRN ("doubling from %f (%f bpm) to %f (%f bpm)\n",
         bp, 60.*44100./512./bp, bp/2., 60.*44100./512./bp/2. );