I want to give audio-input to a FFT code (KissFFT) written in C, on a real-time basis. While I can give a simple test signal (like sine wave) by writing the sine function as input, I am not sure how I should convert an audio-signal (e.g.: song) into a form that can be taken as input by the KissFFT C code.
You use a library like libsndfile to read the song's audio samples and put them into an array, then you pass chunks of that array through the fft.
I have only used openAL for real time audio. I use the circular buffer queuing method. I made 3 buffers, I then queue them to be played with openAL. In a continuous loop, I check to see if a buffer has finished playing, if it is finished, I un-queue it, process it with whatever audio effects I have in the effects chain, then I queue it again.
Of course you're only asking about an fft, are you planning on just doing a spectral analyzer? If so, then you can simply use openAL to get the offset in samples of the audio that you're currently playing, and send a small chunk of the array from that point throught the fft, get the output, graph it, and continue.
I actually get decent performance with this method using openAL, and it's nice because it's very portable code. OpenAL abstracts away dealing with devices.
If you want really good performance, and to use a more suitable method for real time, then you should check out some other libraries like port audio, bass, or you could try and target ASIO for windows, and core audio for mac, using their API's directly, but that may be a long and difficult task.
By the way, I used fftreal, and I think it's great.
Is this a homework assignment? If so, do you have more specific instructions?
I've only done real time audio processing with OpenAL, so I can't comment much on anything else.
The first step is to do a little review of how audio is represented digitally.
The second step is write a simple test program which reads the audio file's samples into an array. For this you should use libsndfile, you can google it, and either download and install it through the package manager or through the website directly. Then you must figure out how to link the library.
After that, you might get the openAL dev package, and read some documentation on it. Then get a simple test program running which reads the file with libsndifle, and passes the resulting buffer (array of samples) to openAL to make an openAL buffer. You could then make a few buttons to press to play or stop, or pause the audio file if you want to get the hang of things. Then you should read up about openAL buffer queueing, and maybe try and find some examples of this online. Like I said, you can also just retrieve the offset into the file which indicates which sample you're on, continuously, and pass a few thousand samples from that point on to the fft, graph and continue.
It's hard to do a step by step because it would be a very long article. You should get started on the first step or two, and when you have trouble you can post your questions, and I may be able to be more specific and helpful.
You also need to find a library to do the drawing.
After you have everything you need, and a good understanding of everything, you can start to write the program.