Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Best practice for C++ audio capture API under Linux?

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

I can't say that there aren't enough audio APIs to do this! Pulse, ALSA, /dev/dsp, OpenAL, etc. My question is what is the current "Best practice" API?

Pulse seems supported by most modern distros, but seems almost devoid of documentation. Will OpenAL be supported across different distros, or is it too obscure? Have I missed any?
Is there not a simple answer?

like image 631
braddock Avatar asked May 26 '10 19:05

braddock


1 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 the other important ones should work too.

Barring that OpenAL works on Linux

EDIT: Also pulseaudio has reasonably good doxygen generated documentation here and some other stuff here and some of the utilities are good examples, you can see them in gitweb here

Also I've written some code that uses pulse for audio input you can look at it here, however I'm not sure I handle everything totally correctly, and I know I'm missing code to handle certain situations... but that should get you started should you go with pulse.

like image 80
Spudd86 Avatar answered Oct 14 '22 08:10

Spudd86