shithub: aubio

Download patch

ref: 41ed384baa8bc17ccf832594e73ce3d7a4806515
parent: 974dddc7e5fc66721c791c6dac2582395f1f39ea
author: Paul Brossier <piem@piem.org>
date: Sat Dec 1 14:16:56 EST 2007

fft.c: if real part is zero, have phase = 0

--- a/src/spectral/fft.c
+++ b/src/spectral/fft.c
@@ -154,6 +154,8 @@
   for (i = 0; i < spectrum->channels; i++) {
     spectrum->phas[i][0] = 0.;
     for (j=1; j < spectrum->length - 1; j++) {
+      if (compspec->data[i][j] == 0.) spectrum->phas[i][j] = 0;
+      else
       spectrum->phas[i][j] = atan2f(compspec->data[i][compspec->length-j],
           compspec->data[i][j]);
     }