You should not use OSS with Ubuntu

Last night, byuu messaged me raving about how great the new OSS4 sound drivers are. The update, released six days ago, offers only minor changes from past OSS versions.

I used OSS in 1998 to get my old ISA Creative AWE64 sound card to work under SuSe Linux. OSS was great back then. I may have even used it with Mandrake Linux in 2000. However, since returning to the OS with Ubuntu earlier this year, I have been using ALSA drivers.

There is a reason for that, and I only learned why last night.

First a little history. A long time ago, ALSA did not exist. Linux needed a sound API: more specifically, it needed sound card drivers. 4Front Technologies appeared on the scene with OSS, the Open Sound System. This was for the most part the first Linux sound API that actually worked. The driver started as a few kernel patches that never made it into the kernel, and eventually, they split away to expand and become OSS.

For a long time, OSS did make a half-hearted effort at supporting the GNU people by releasing OSS/Lite, a series of drivers to support the old Soundblaster 16 and AWE32/64 cards. Remember using isapnp to dump all the data from your ISA sound card to get your game ports working? That was because OSS needed it.

In the Linux 2.2.x tree, sound went modular and split from OSS. Its API was basically similar, but missing features from the commercial version.

The Advanced Linux Sound Architecture (ALSA) was later started when a bunch of people wanted more control over the Gravis Ultrasound sound card. It was originally an API for that card, but eventually expanded to cover more cards. This shows, because the ALSA API is absolute shit. Anyone who thinks classes were simply hacked into PHP cannot appreciate how much hackery the ALSA API has.

Basically, ALSA wanted things not supported in the free OSS: hardware MIDI (still missing from most cards, even in ALSA), hardware mixing, full duplex mode and something friendly across multiple architectures.

That said, OSS has continued to develop. It supports far more cards than ALSA, but most of the ones it supports are older hardware. In July this year, it returned to being “free” software in the GNU sense of the word — that meaning anyone can rape it to hell, re-tag it and sell it as his own while giving nothing back to the original authors except patches.

In July of this year, OSS code was again released with a GPL-compatible license, making it free enough for zealots. What implications this will have for Linux during the next to years remains to be seen.

It offers a far better API to be sure, but there is only one caveat: no one has been developing for OSS since the 2.4.x kernels. Currently, Ubuntu and most distributions are using the 2.6.x series of Linux kernels, which are built for ALSA. In fact, as of kernel 2.5.x, OSS was officially marked as deprecated.

Complicating things further, ALSA can emulate an OSS layer, but OSS cannot currently emulate an ALSA layer. A library is in the works to rectify this, but it is only an unstable beta which 4Front Technologies has already stated it may kill.

Enter the conflict.

ALSA, due to its bastardly licensing, is for Linux only. Any software written for ALSA will not be usable on BSD or Solaris.

QNX, the true real-time OS, has its own sound system called QNX Sound Architecture (QSA), which is actually more similar to ALSA than OSS, but still not cross-compatible. But last I checked, wxWidgets isn’t supporting Photon anyway.

This is a serious problem, because the only way to have actually cross-platform audio becomes SDL, which will just jack into another sound system. Anyone who has used SDL extensively will be more than happy to pipe in about how much it sucks — in fact, most of its proponents seem to be people who have never written a line of code in any language, let alone for SDL.

History lesson over, back to the story.

So I am told how wonderful OSS is and how holy-man-tits if you use it it has no latency. What is latency? Sounds like delay, but before yesterday I didn’t know either. Somehow everything about your machine will just be better if you use OSS.

I tried it.

First, the good points. It is true that sound cuts far less often with OSS — mostly due to its module giving it favored access to the CPU at the cost of the rest of your system. It also has the correct levels for my laptop’s AC’97 Audio Controller so maxing my PCM volume no longer results in overdriving sound output and getting distortion. That was pretty cool.

Now the bad point, or points: every piece of software on my machine which used audio broke in some way.

Some were easily remedies, some were not. Wine completely died, and contrary to the advice given by Nach, Ubuntu does not supply a magical wine-oss package; neither does the official WineHQ repository. SDL was fixed by installing libsdl1.2debian-oss, which repaired Gens and a few other applications.

And then things really took a down turn.

For Xfce users familiar with controlling their volume with the mouse wheel, you will be delighted to know there is no OSS-compatible version of the audio plugin. The Gnome plugin fails because it can only link to the Gnome mixer, which is useless with OSS and can only control the main channel. In fact, the only mixer to work with OSS is ossxmix, which looks like shit.

Perhaps the best part is that ossxmix does not save settings, and you have to run a separate application every time to save settings if you want your sound back to the same way after reboot. Sure, I could replace /usr/bin/gnome-volume-control with a shell script to run ossxmix and saveoss in that order, but I have a feeling that will probably break the Gnome plugin anyway.

Oh, no, I know the best part.

From boot, OSS is not fully operational. Its modules are not all recognized. Don’t believe me? Try running Audacity, the best Linux sound editor. It is built with wxWidgets and OSS for multi-platform support. In fact, it never even had ALSA support until earlier this year. What happens when you run it?

audacity: src/hostapi/alsa/pa_linux_alsa.c:608: BuildDeviceList: Assertion `snd_config’ failed.
Aborted (core dumped)

Oh shit, why is it trying to grab ALSA? Must be my old config settings? Nope, wiping them does nothing. It was revealed on a forum that — as far as Audacity knows — you don’t have OSS. Why not? Because OSS not “coming up” after boot. You have to manually run ldconfig before Audacity can find it.

Writing a script to run that at the end of every boot sounds like a great way to lag boot time by 10 seconds.

This will get Audacity up and running, but recording will crash it with another fun error:

audacity: src/hostapi/oss/pa_unix_oss.c:1615: PaOSS_AudioThreadProc: Assertion `frames == framesAvail’ failed.
Aborted (core dumped)

It seems this is because when something tries to access any bit depth of audio different from what you set in ossxmixer, OSS offers no fallback — it dies.

So you fix that and what happens next?

Remember those great volume and mute keys on your laptop you have been using for three years across multiple operating systems? They now cause OSS to core dump. It dies so hard that the only way to bring OSS back is to manually execute /usr/bin/soundoff & /usr/bin/soundon from root.

The final straw was when I moved Wine to use OSS. Using Wineconfig, I moved to the audio tab when a fun message appeared.

Uh oh, it looks like you don’t have ALSA anymore. I’m going to just go ahead and tank every registry entry pertaining to ALSA for you — you know, those ones you spent months customizing in regedit because my menu doesn’t let you access them all. Tee hee hee!

This window, of course, only has an OK button. There is no escape.

Following this change, I checked OSS, and every single Wine application began to crash instantly upon accessing the sound card.

Oh, lastly and perhaps least importantly, I lost all ability to play MIDI files because Timidity is, you guessed it, ALSA based. Someone did extensive hacking of it to make an OSS-compatible version, but do you really want to compile all that?

The reason Ubuntu is popular is because it is convenient. It is convenient because it is built on Debian. Debian’s APT is a beautiful thing, and the front ends to APT made by Cannonical make updates and software installation simpler than on Microsoft Windows.

What user is going to go through all the bullshit written above just for a sound core that is “better” just because everyone says it is?

Want to solve latency issues in ALSA? Install the UbuntuStudio kernel. All that takes is an `apt-get install linux-rt`. Substantially simpler than hacking your entire system into being OSS-compatible.

I admire what OSS is doing. It is great that anything written for it will also support other Unix-like platforms. However, for average Linux users running a 2.5.x or 2.6.x kernel, it is simply impractical.

There is no reason to go through so much when you can simply get a kernel which gives its ALSA-compatible drivers the same access advantage the OSS drivers boast.

In the end, I tanked OSS from my system and spent 20 minutes restoring all my configurations to ALSA.

I was able to record 20 minutes of audio in Audacity on ALSA with no hiccups or similar problems. I was able to get Skype 2.0 running. I was able to run all my normal applications and enjoy the same familiar user experience. I was able to have satisfactory sound as long as I did not max my PCM channel.

At the end of the day, is that not what using the computer is all about?

If Linux moves back to OSS or OSS prepares a solid ALSA emulation layer, I will give it another shot. However, as things stand, attempting to force it into Ubuntu is the same kind of dick waving loved by users recompile their kernel just to save 710 kilobytes of RAM.

Currently, the entire OS is prepared and packaged on the assumption the user has ALSA. Switching to OSS hurls you out of that paradigm and renders APT essentially useless for anything involving audio.

If that is the kind of user experience you prefer, perhaps it is time to investigate Slackware Linux.

byuu and I are doomed to disagree on this one because he loves FreeBSD — which is OSS only — and tends to avoid as much GNU software as he can.

I may hate the terms of the GNU and love QNX, but it is not a practical desktop option because the software does not support QSA. Depending on what you do with your computer, you may have the same problem with OSS.


About this entry