Monday, March 11, 2013

FFTW3 Sound Spectral Analyzer Example

Using libsndfile, ncurses, alsa-libs and of course fftw3 library, one can write a 200-liner console program in C that performs spectral analysis of a sound file while playing it. This is of course limited to audio files supported by libsndfile, which is currently wav and ogg. But nothing prevents people to do lame -d or use a similar decoder and pipe the resulting wave to the program.

What I am talking about? Look:

https://github.com/jirislaby/collected_sources/tree/master/snd_fft