Audio in linux, how to put it into words? How about: oss, alsa, pulseaudio, esound, arts, portaudio, jack, gstreamer, phonon. Did I miss any? Embarrassment of riches? Or just embarrassment?
I will not rehash history any more than to say that between buggy/incomplete drivers for sound cards and the wonderful world of alsa I've never been able to understand how the hell audio works beyond getting output and, sporadically, input. I am the quintessential dumb user of linux audio, even though I have tried to figure it out.
But let past be past. Ubuntu 8.10 Intrepid. Pulseaudio ready and everything, since 8.04. Why Ubuntu decided to plug in pulseaudio without setting up any gui controls for it is beyond me. All I know is that occasionally sound output will stop working (I get 2 seconds of output and then it stops) and then "pkill pulse" cures it.
Let's run through the list.
I've learned to use alsamixer to fix low level audio problems. It is reliable in that it gives me all the channels on my sound card, so I always use it to mute/unmute my microphone and to untangle the master/pcm/headphones/front speakers settings caused by mixers that only allow me to control the volume of one channel and apps that output on god knows what channel.
That's alsamixer on a Ubuntu 8.10 desktop with all updates installed as per today. Here's the same thing on my laptop.
Same distro, same version, all updates installed. And I have made no conscious choice for this to come about, all I did was install the pulsaudio gui tools. All of a sudden, alsamixer is useless as it only has access to a single "master" channel. It would appear now that pulseaudio is sitting between the sound card and alsa, but does that sound right?
pulseaudio is here, might as well use it, right? Ubuntu ships a bunch of pa* packages that are gui tools for pulseaudio (not installed by default). This one is called pavucontrol. It lets you set volume per audio stream. I love this, I've wanted to have it since forever.
But then it comes to output and what do I see?
A single output device. Where is my master, my pcm, all my channels? What's more bizzarre is that pulseaudio says it's connecting to alsa while alsamixer says it's connecting to pulsaudio. Surely that way madness lies?
What's worse, pavucontrol is a gui app without any kind of systray integration, so much as I would like to use it as an easy-to-reach mixer, I can't.
I run kmix in my tray, it lets me set the volume by scrolling the mousewheel over the icon, which is exactly what I want. It's not a terribly impressive mixer, as it only lets me select one channel to control, whereas what I really would like is to be able to lock several output channels into one, otherwise I'm never really in control. So the best I can do is set the volume to max on master, and tell kmix to show me pcm. That seems to work well enough.
It appears I have two identical channels, but the leftmost is misnamed, that's actually Master.
Now, let's see. alsamixer doesn't show any of these channels, because it delegates to pulseaudio. So kmix connects to... god knows what, but at least I can access these channels.
Gnome's volume manager is an interesting one. It has a combo box for devices. I'm showing here all the devices related to output and how channels are connected.
The good news is that the channels in the default mixer correspond to those in kmix (sweet sanity!). But then there is that bottom mixer with a channel of the same name as the single output channel in pavucontrol. And yes, they are the same (and the same as the single output in alsamixer).
But this channel appears to be some kind of composite output channel that has no bearing on any of the output channels in the top mixer (or in kmix). (Ie. while it might appear to be a composite pipe that aggregates the flow of all these standard channels, it's actually a pipe that sits after all of them. If pcm volume is 0, this channel won't receive any input, and will be mute no matter its volume setting.)
So neither can I effect the settings of master/pcm/etc with this channel nor vice versa. That means if I want to use this single channel as my master volume control, I have to make sure that absolutely no application can mess with the volume for any of the standard master/pcm/etc channels. Good luck with that.
A sane spec
I know this sounds crazy, but what's it gonna take to get a single server+mixer applet that
- captures every possible audio stream, no matter the audio server/api it's on,
- prevents applications from messing with master volume controls (eg. mplayer),
- has a single virtual channel controlling all the underlying output channels, so that I can have a single master volume slider,
- has per stream/app volume controls pulseaudio style,
- integrates well into the systray,
- integrates with laptop hotkeys
UPDATE: Ubuntu users can now vote on a proposal to unify sound systems on ubuntu brainstorm. Hopefully this idea and the related ones can gain some traction with Canonical to attack the problem.