Best practice for C ++ audio capture APIs on Linux?

I need to create a C ++ application with a simple audio recording from microphone functions.

I can’t say that the audio API is not enough for this. Pulse, ALSA, / dev / dsp, OpenAL, etc. My question is, what is the current Best Practice API?

Impulse seems to be supported by most modern distributions, but seems almost devoid of documentation. Will OpenAL be supported through different distributions, or is it too obscure? Am I missing any?
Is there a simple answer?

+7
c ++ linux audio audio-recording
source share
3 answers

Lennart Pottering has a guide here:

http://0pointer.de/blog/projects/guide-to-sound-apis

basically use the "safe" subset of alsa, then all other important ones should work too.

Disabling OpenAL on Linux

EDIT: Also, pulseaudio has pretty good documentation created by doxygen here and some other things here , and some utilities are good examples, you can see them in gitweb here

I also wrote code that uses momentum for audio input, you can look at it here , however I'm not sure that I’m doing it right, and I know that I don’t have enough code to handle certain situations ... but this should get you started if you go with a pulse.

+4
source share

there is no simple answer; best practices depend on the context and specific use cases to which your application will apply.

for maximum ease of programming and the widest audience, I would choose gstreamer because it is fast and simple, well integrated into gnome and ubuntu and supports a wide range of audio subsystems and configurations. he is very flexible.

for example, the command:

gst-launch autoaudiosrc ! audioconvert ! flacenc ! filesink location="foo.flac" 

will create a .flac file from the microphone input, regardless of the audio system (Pulse, ALSA, ESD ...). an equivalent pipeline can be written using c / gobject bindings, as described here .

ps the above command requires the gstreamer-tools package

+1
source share

GStreamer will give you and end users maximum flexibility in capturing sound, but its cross-platform vitality is not that great, especially on OS X.

0
source share

All Articles