Hello, I am working on an audio spectrum analyzer with
I am working on a program to calculate the FFT spectrum of an input
All the functions from CMSIS library work fine but I don't understand
the length of the input and output vectors.
The ARM CMSIS official documentation is, in my opinion, a bit
confusing on this topic and I'd like to share my thoughts.
Here's an outline of my algorithm:
Start with a sample buffer of length N=1024 (Skip how the samples
are acquired, let's just assume they are there)
Now this is a real signal, so calculate the FFT using
arm_rfft_fast_f32(&fftInstance, rx_buffer, fft_out, 0);
From the official documentation
I understand that arm_rfft_fast_f32() outputs an array of N=1024
floats: N/2 are the real parts and N/2 are imaginary parts
interleaved, in total N/2 complex pairs.
This is only one half of the spectrum since the other half is
symmetric. So the spectrum is not replicated.
Now, I want to calculate the magnitude of each complex number so I
arm_cmplx_mag_squared_f32(fft_out, fft_magnitude, 512);
With this, I get a spectrum of 512 points, symmetric arround
the point 256. So in total, I get 256 useful points. Is this the
expected behavior? I thought that arm_rfft_fast_f32() output already
only half of the spectrum, thus I should end up with 512 useful
points. Where am I wrong?
Hi Victor, I'm currently facing the exact same phenomenon. Even though it's three years since you've posted your question, I'm curious whether you found an explanation/solution? Thanks!
View all questions in Keil forum