r/linuxdev • • Sep 27 '13
How can the Linux audio infrastructure mess be fixed?
One complaint that has been leveled against Linux is that the audio infrastructure is messy and thusly has too many failure modes. I'm using Linux and enjoying it, but I think there may be a valid complaint here. I'm currently new to programming, and I still haven't learned digital audio signal processing, but I have plenty of free time. I could learn a great deal in a reasonable amount of time. I'd love to develop something that can replace parts of the infrastructure with a single framework. My question is: what are your thoughts on it? What would be the best route to clean up the infrastructure? Does it need to be cleaned up at all?
View all comments
164
u/wadcann Sep 27 '13 edited Sep 28 '13
The issue isn't signal processing.
There are a couple of issues:
ALSA/OSS
aoss <command>to run the command and obviously was problematic for non-technical users. It would intercept calls to OSS and translate them in userspace to ALSA.aosswouldn't work with 32-bit binaries (i.e. all commercial games) on 64-bit systems. You could custom-compile a 32-bit version, but no distro maintainers provided a 32-bit version. Even today, with 32-bit machines mostly dead, Debian's multiarch work (probably one of the better distros in providing support for simultaneous 32- and 64-bit work) doesn't provide for a 32-bit aoss out-of-box on a 64-bit system. So you'd have OSS apps on a 64 bit system having sound not working, some of the time.One more note. ALSA in particular tended to try to expose lots of features on the hardware, as opposed to a least-common-denominator simple OSS model. Often, sound cards have many different volumes. This can mean many, many switches, which are often confusingly-named (especially since sound vendors sometimes churn out different versions of a card without indicating what output exactly a volume control affects). This isn't so bad for "Master volume" and "CD volume", but it can become staggeringly-complex. On my main playback soundcard today (an elderly, inexpensive Sound Blaster card, not a pro audio card), ALSA exposes the following settings for playback alone (with my description in brackets):
For Joe User trying to figure out why no sound is coming out of his headphones, this is more-than-a-little intimidating, and understanding some of these (AC97? Wave?) requires a least some basic understanding of the way his system is working at a technical level.
Oh, and ALSA has fairly powerful but complex settings; not an issue for most users, for which things just worked out-of-box, but I have four or so soundcards in my computer, one of which has config lines that look like:
...to name the seven or so inputs on the card in software with how they're labelled on the plugs.
This is kinda overwhelming for Joe "I wanna make music" musician who has a fancy pro audio card that has a bunch of inputs and wants to know which output is what.
Needless to be say, while this provided wonderful control over the hardware, the combination of no simple explanations on these, some not being functional or present on some hardware, and a lot of possibly-subtly-interacting controls could be quite complicated. Windows-oriented user manuals tend to not describe what a particular setting on the card does, but rather what to push in the UI.
Sound servers
Go back a ways, back to when I was first talking about the early OSS drivers. Linux has traditionally had a windowing system that provides network transparency. This means that you can, even today,
ssh -X <remote system>and run a program on a remote machine, and it will show up on your local display. (Though the Wayland and Mir people run the risk of breaking this today, it has survived for a long, long time.) The X11 protocol used provided the way to cause a beep to happen on the remote machine, but no sounds above-and-beyond this.The obvious solution was to provide a sound server, much in the same way that X11 used a display server.
Several apps provided their own sound servers. Pysol had its own sound server. xpilot had a sound server, IIRC. There was the YIFF sound server, probably a few more. This meant that you could use them remotely with sounds. Apps had to be specially-written to use these, obviously.
You could also use a sound server with a locally-running application.
Several folks looked at the situation and said "let's make a single sound server instead of multiple app-specific ones that everyone can use".
This resulted in the creation of Esound from the Enlightenment project, which was used by GNOME for a while, and aRts, used by KDE. These had their own incompatible interfaces. (Later sound servers included JACK and PulseAudio).
There was one major benefit that these provided that made them also useful for local use. Remember how I said that OSS/Free didn't support hardware mixing? It also didn't provide software mixing. ALSA, for a long time, didn't support software mixing either (and in any event, the resulting dmix plugin was somewhat inconvenient to use and not configured by default). That meant that only one program could use the sound card at once. If it had opened the thing, nothing else could be using it (unless you had a sound card that supported hardware mixing and either commercial OSS or ALSA).
A sound server could mix the audio coming from several programs in software, and then send it to the card as one stream. This meant that as long as all of your programs were using one sound server, and as long as you were only using one sound server, you could have multiple things playing back sound.
[continued in child]