shithub: aubio

Download patch

ref: 9e5622841f97cb424f98ba13d418bc4514f51340
parent: b173ca14d2eb00b49c1bfdd75a1fa8cb8b32cc46
author: Paul Brossier <piem@piem.org>
date: Sat Mar 2 17:48:49 EST 2013

src/mathutils.c: fix computation of gauss window

--- a/src/mathutils.c
+++ b/src/mathutils.c
@@ -104,8 +104,16 @@
           - 0.01168 * COS(3.0*TWO_PI*i/(size-1.0));
       break;
     case aubio_win_gaussian:
-      for (i=0;i<size;i++)
-        w[i] = EXP(- 1.0 / SQR(size) * SQR(2.0*i-size));
+      {
+        lsmp_t a, b, c = 0.5;
+        uint_t n;
+        for (n = 0; n < size; n++)
+        {
+          a = (n-c*(size-1))/(SQR(c)*(size-1));
+          b = -c*SQR(a);
+          w[n] = EXP(b);
+        }
+      }
       break;
     case aubio_win_welch:
       for (i=0;i<size;i++)