shithub: aubio

Download patch

ref: 4f872d75e8e2e81d50724bb0d7e75ce297d0443b
parent: cb243f285a2b65c583f214b7ccbb5cea33b5471f
author: Paul Brossier <piem@piem.org>
date: Fri Mar 15 17:46:34 EDT 2013

src/spectral/specdesc.c: add more noise to make sure log doesn't explode when fftnorm is very small and old fftnorm is null

--- a/src/spectral/specdesc.c
+++ b/src/spectral/specdesc.c
@@ -193,7 +193,7 @@
     onset->data[0] = 0.;
     for (j=0;j<fftgrain->length;j++) {
       onset->data[0] += fftgrain->norm[j]
-        *LOG(1.+fftgrain->norm[j]/(o->oldmag->data[j]+1.e-10));
+        *LOG(1.+fftgrain->norm[j]/(o->oldmag->data[j]+1.e-1));
       o->oldmag->data[j] = fftgrain->norm[j];
     }
     if (isnan(onset->data[0])) onset->data[0] = 0.;
@@ -206,7 +206,7 @@
   uint_t j;
     onset->data[0] = 0.;
     for (j=0;j<fftgrain->length;j++) {
-      onset->data[0] += LOG(1.+fftgrain->norm[j]/(o->oldmag->data[j]+1.e-10));
+      onset->data[0] += LOG(1.+fftgrain->norm[j]/(o->oldmag->data[j]+1.e-1));
       o->oldmag->data[j] = fftgrain->norm[j];
     }
     if (isnan(onset->data[0])) onset->data[0] = 0.;