From: Paul Brossier Date: Sat, 1 Dec 2007 18:16:56 +0000 (+0100) Subject: fft.c: if real part is zero, have phase = 0 X-Git-Tag: bzr2git~419 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=41ed384baa8bc17ccf832594e73ce3d7a4806515;p=aubio.git fft.c: if real part is zero, have phase = 0 --- 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]); }