tags:

views:

57

answers:

2

Hello, I need in analyzing system output sound runtime. OS: Linux. The first thing I need is get different frequency values. Programming language: c++.

+1  A: 

The question is a bit vague, but here's some potentially useful information.

PCM-encoded WAV files are pretty easy to parse; you don't really need a library for that.

For the frequency analysis, I would use FFTW to do the Fourier transform.

Thomas
And what about grabbing music from given source?
Ockonal
What kind of source? An MP3 file? A webcast? A microphone input?
Thomas
No, system master-output.
Ockonal
In Windows, that would depend on the sound card; not all cards offer an input that "loops back" the sound sent to the speakers. In Linux, I don't have a clue. Maybe you should edit your question to be more specific.
Thomas
+1  A: 

One semi-portable* way that comes to mind for grabbing all the sound from multiple sources is PulseAudio. (In this case, semi-portable means working with many sound cards, not working with different OSes, though there is a WinXP version of PulseAudio). One of the PulseAudio modules provides a pipe sink. Hopefully all your outputs will be PulseAudio-compatible - nearly everything that plays nice with ALSA should be fine. You should then be able to just read from that pipe to get your input.

You can then use a library like FFTW (first suggested by Thomas' answer) for fast Fourier transform, assuming this is what you mean by 'get the frequency values'.

*In this case, semi-portable means working with many sound cards, not working with different OSes, though there is a WinXP version of PulseAudio (haven't tried it myself).

Jefromi