From 41ed384baa8bc17ccf832594e73ce3d7a4806515 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 1 Dec 2007 19:16:56 +0100 Subject: [PATCH] fft.c: if real part is zero, have phase = 0 --- src/spectral/fft.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/spectral/fft.c b/src/spectral/fft.c index 8bff6ac1..6c8c578a 100644 --- a/src/spectral/fft.c +++ b/src/spectral/fft.c @@ -154,6 +154,8 @@ void aubio_fft_get_phas(fvec_t * compspec, cvec_t * spectrum) { 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]); } -- 2.26.2