Home Home > 2015 > 01 > 16 > Linux audio library smackdown part1: Portaudio
Sign up | Login

Deprecation notice: openSUSE Lizards user blog platform is deprecated, and will remain read only for the time being. Learn more...

Linux audio library smackdown part1: Portaudio

January 16th, 2015 by

Common disinformation people tends to believe in is that Linux Audio is in bad shape. Actually it’s not. They are right ALSA is getting bit rusty and it’s not top of the notch but list of supported sound cards is long. There have been speak about next generation audio API for Linux but nothing is really happening (I’m happy if you prove me wrong!). Last year I had task to evaluate different Linux audio libraries for playing audio and recording. So these articles try to make some light to my journey and what did I found. inpatient can go to Github  https://github.com/illuusio/linux-audio-example/tree/master/portaudio. There is other library examples also but only Portaudio is currently updated to my last version. I wrote same very simple application to test every audio library. I’ll upgrade rest of the examples and add also Xiph libao and GStreamer.

Application

Like I said example applications are very simple. With Every library I tried to write playback and record example. If you can use blocking API interface there is blocking example also. In these Examples I use sndfile because API is super easy to use and I could test with WAV. So no troubles big bobbles approach.

Code

I won’t be posting code here it can be found on Github repository. I tried to be super clear as they are examples and added comments as needed but if you don’t get glue fault is all mine.

Portaudio

Supported outputs: Alsa, Oss, Jack, Mac OS X CoreAudio and Many Windows Audio API’s

Why do want to use something else than ALSA? If you need to support other platforms than Linux you get idea of cross platform API for audio. Portaudio is hidden gem of Linux audio libraries. It’s stable as can get. Portaudio has blocking and callback support. It has Float 32-bit Int 32-, 16- and 8-bit input/output. I tries to be very high end in every corner. Also licensing is very liberal.  For a while It’s has seen slowing development  because main developers have something else to do in life.

For me biggest no-no for me was lack of Pulseaudio support (I go so upset that I wrote Pulseaudio  hostApi for Portaudio but that is worth of another blog post). Portaudio supports Windows, Linux and Mac OS X so it’s good choice if you need same quality audio in every platform.

Biggest minus in Portaudio is there ain’t much applications using it. There is some highlights like Mixxx and Audacity. Rest of the list can be found here. Why it’s not more popular I can’t say because it’s easy to use.

Summary: Simple but powerful API for I/O which I can recommend. So go and see examples if it’s for you and documentation from official pages. Next time we get on Pulseaudio.

Both comments and pings are currently closed.

3 Responses to “Linux audio library smackdown part1: Portaudio”

  1. Etam

    Hi,

    It’s good to see such work. Audio APIs always were a mystery to me.

    I’d be thankful if you could make an article describing in general what are alsa, oss, portaudio, pulseaudio, gstreamer, etc. what are their tasks and abilities and how they are related to each other.

    Also a good thing to explain would be: If I have an app that uses portaudio, which supports and uses pulseaudio, what is the path between my app and soundcard?

    Can’t wait for next parts. Good job! 🙂

    • Thanks for kind words. First my idea was to get Pulseaudio blog out but because of life Portaudio was first in line. In Pulseaudio blog there gonna be little light for how Pulseaudio live upon Alsa and OSS. So if I have time I’m going to draw small image but if not seek some from net 😉
      But currently path from Portaudio (if you have Pulseaudio and ALSA-Pulseaudio driver) is PortaudioALSA-APIALSA-Pulseaudio-drvPulseaudioALSA-output and without Pulseaudio it’s PortaudioALSA-output.

  2. Alexander Ahjolinna

    Portaudio was just removed from MPV. because It was just completely useless and it was semi-broken and underfeatured…. There is already good native support for all 3 desktop platforms, and ao_sdl or ao_openal as fallbacks.