I need to do FFT on an audio file(to be exact it is a real number array of audio samples). But the output of FFT should be complex numbers. I have a hard time understanding how to convert this. For example: input is int input[N], and what to do next to get the output.re[] and output.imp[]? Should I treat input as a complex array only all the imaginary components equal to 0? Thanks!


1 Answer 1


Your question is so "basic", so "fundamental", that I may be misunderstanding its true meaning. In any case, hopefully you have some software routine available to you that performs FFTs and will accept your 'int input[N]' sequence as an input. I have no idea what software 'package', or software language, you're using but if variable 'x' is your input sequence then there should be some available command (or subroutine) like

Spec = fft(x)

you can use to compute your FFT spectral results. And there should be no need for you be concerned about defining your input sequence as complex-valued. Of course the length of your input sequence (number of samples) must be an integer power of two. Your FFT results will automatically be in the form of a sequence of complex numbers, so there's no need to worry about that.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.