This project has moved. For the latest updates, please go here.

Code example of using FFT on a live audio stream

Feb 26, 2013 at 4:56 PM
Does anyone have any example code of how to use an FFT on a live audio stream. I know I need to put the code into "frames" but don't know how to go about doing that. A simple example would help a lot.
Feb 27, 2013 at 1:44 PM
You can take a look at the NAudioDemo-Project. It contains a live-audio-stream demo. Take a look at the code how the audio gets decoded.
You will find out that there is a BufferedWaveProvider which stores the decoded raw audio and serves it to the playback-callback(hmmm funny word combination :D).

You need to calculate the FFT somewhere between the BufferedWaveProvider and the SoundOut itself because when the audiodata are in the BufferedWaveProvider it won't make any difference whether you playback a file or live-audio-stream. So first implement the buffering and decoding of the audio stream itself. After that you can continue with taking a closer look at the WPF-Demo application. There you can find a sample visualisation using a fft.
Feb 28, 2013 at 12:55 PM
Thanks for the advice