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:

1 comment:

ng said...

Your code is very useful and it helped me to understand some things, thanks!^_^

Just can you explain, why do you divide holder->samples[a] on channels in compute_avg()?