[Cialug] Linux audio programming

Matt Stanton matt at itwannabe.com
Sat May 2 15:05:03 CDT 2015


I'm far from a Linux sound expert (or kernel expert), but the way I 
understand it, ALSA is the "low level" sound standard for Linux.  I 
believe that PulseAudio and the other sound daemons sit above ALSA and 
use it to actually interface with the sound hardware controlled by the 
kernel.

PulseAudio is installed by default on Ubuntu and its derivatives (maybe 
Debian, too?), Mageia, Mandriva, OpenSUSE, and Fedora.  I'm not sure why 
to use PulseAudio over ALSA except in certain specific cases.  
PulseAudio is a "networked" sound daemon, so you can have all the sound 
on all the Linux computers running PulseAudio in a lab routed through a 
single PulseAudio daemon on one of those computers (because someone 
snuck in a set of USB speakers when none of those PCs/workstations 
didn't have them already?).  PulseAudio can reroute all sound that was 
supposed to go directly to ALSA through itself, then back through ALSA 
to the sound hardware, so I guess you could route sound from a server 
that was supposed to go to that server's hardware through ALSA through 
PulseAudio, out to a remote desktop session on a client PC, then through 
PulseAudio->ALSA out to the client PC's soundcard.

If you want to interface at a lower level or if you have no need to 
route all sound output through one daemon just so you can have a single 
software master volume control, then ALSA is as low as you can go and is 
all you need for a single PC.  On top of that, you can still get the 
program's audio through PulseAudio thanks to its ability to hijack 
ALSA-bound audio, anyway.

If you want to target what is currently "hot", though, I guess directly 
targetting PulseAudio is the way to go.

-- Matt (N0BOX)

On 05/02/2015 11:58 AM, Daniel A. Ramaley wrote:
> A number of years ago i wrote a program that generates audio. I wrote it
> to output using OSS, since that was the standard way of doing audio at
> the time (late 90s). I'm thinking of modernizing the program but can't
> discern what the most standard/compatible way of outputting audio is
> today. It seems that component of Linux has fragmented a bit. Should i
> target Alsa? Pulse? SDL? Something else? Looking for suggestions; my
> goal is to do a rewrite and then not have to touch it for another 15-20
> years as i did when i wrote the original. I'm looking to learn 1 current
> audio standard well enough to write code that targets it, but not
> looking to become an expert in all the choices available these days.
>
> The reason i'm considering doing this is 1) to get a bit of practice
> with somewhat low-level programming since i've not done it in awhile,
> and 2) to make it work better on modern systems. The old version still
> runs, but it is unable to share the audio device (and refuses to run if
> some other application is using it) and the audio it produces sounds
> choppy and incorrect leading me to think that while the Linux audio
> stack still supports OSS, it isn't handling it perfectly anymore.
>
> __
> Daniel A. Ramaley  |  Network Engineer 2
> Drake Technology Services (DTS) | Drake University
>
> T: +1 515 271-4540
> F: +1 515 271-1938
> E: daniel.ramaley at drake.edu
>
> _______________________________________________
> Cialug mailing list
> Cialug at cialug.org
> http://cialug.org/mailman/listinfo/cialug



More information about the Cialug mailing list