24 June 2009

Linux sound-system sucks!

Yeah, so I've been running Linux / Ubuntu now for about 4 months, and it has been a pleasure almost the whole way. I've had to dabble in Windows from time to time, especially "supporting" our two other Windows machines in the house, but every time I meddle with them, I'm extremely happy to return to my Ubuntu Jaunty 9.04. For the most parts.

There is this one area which sucks, though, and I mentioned it in one of my previous reports that I couldn't get the microphone to work. Here's the low-down on this whole thing ;

Ubuntu comes out of the box with ALSA (Advanced Linux Sound Architecture) and PulseAudio (a client/server system for sound over networks, amongst other things), and the two connected together in GNOME (the default Window manager it uses) should in theory work. But the forums and intertubes are abundant with problems relating to sound setup, anything from sound not working at all, some aspects not working, cracking or garbled sounds, and so on. Because Linux is open-source and has the advantage of "so many options", then the disadvantage of "so many options" also becomes quite clear.

When you write your software you write for either OSS (Open Sound System; try Googling for OSS and they'll translate it into Open Source Software ... AAARGH!) or ALSA, and both packages have wrappers for eachother, but it means that there's a multitude of ways to reach that haven of good supported sound. We can throw ESound and Gstreamer and JACK into the mix for further confusion as well.

So, one perticular part of these options was that the Linux kernel guys decided to throw out OSS and put in ALSA instead, at around Kernel version 2.5.x or so. The reason was mostly that OSS v.2 was in wide use as the developers entered into a lengthy v.3 rewrite, the company that sponsored them changed the license (dual license, one branch for GPL [often lagging], another for a sellable version). Then they scrapped v.3 to start on the new and improved v.4, which was to be fully GPL'ed and all things sorted out. In theory, but in the mean-time the world moved on, and ALSA became the standard.

So, back to my story. My sound system was finally working, except for the fact that my microphones (plug and internal) didn't work. I tried it all, including downloading and manually compiling and modding the Kernel with the latest version of ALSA drivers and libs, without any luck. (Well, I upgraded ALSA nicely, but alas no microphones). I tweaked manually the modprobe configuration files, upgraded and updated any Esound, Gstreamer or ALSA thing I could find, tweaked their links configs, reset them, autodetection and manual stuff, on and off, on and off. It drove me nuts!

So in the end I got the whiff of the OSS story. First it was simply dismissed because it was "the old system", but as more and more reported success with the latest OSS v.4 where ALSA failed, I thought I'd give it a try. I removed anything ALSA and PulseAudio (and frankly, not that many people have a need for PulseAudio, even less be able to correctly set it up, so why make it default?), installed some dependencies for OSS, downloaded a .deb package (trickier than it sounds), restarted, installed, configured (setup GNOME with the OSS sinks), and ...

Microphones work! They friggin' actually work, and after only 4 months I can make Skype calls which I need for work. But, as sound in general works fine - and here's the punchline! - now the left channel has crackling when the sound reaches a certain low / mid threshold (no, the mixer is set correctly; this is weirder in that it's only in the left channel. It's not overdrive, but some clicking-ish noise), and I can't friggin' get rid of it!

And yeah, you try searching the intertubes for Ubuntu 9.04, sound and OSS v.4 where "OSS" is treated as "Open Source Software" by Google. Bloody smart-arses.

Sure I love Linux, but I friggin' hate the Linux sound system. And I hate Google a little bit, too, this time.

Labels: , , , ,

28 April 2009

Nightmare

Update: See bottom.

You know that sinking feeling you get when you're sitting in the root directory of your Linux box, trying to recover the system from a configuration mishap and slightly unaligned update, when you press Enter after typing in "rm -r *"?

Yeah, well, I kinda had a stressing day today. Well, it started yesterday with PulseAudio (the default sound server in the latest Ubuntu) not giving me the desired effect (which is, you know, sound), so in my infinite wisdom I chose to prod a little, configure a little and run various tools in order to fix things. Because I'm a bit of a noob when it comes to all things Linux and Ubuntu these days, little by little I chipped away the things that were working, ending up with a system completely broken.

My computer is a Toshiba Satellite P300. So, I upgraded Ubuntu 8.10 (which I have been very, very happy with) to the new and tasty 9.04. I tried to upgrade through the update-manager a number of times, but my internet connection is a bit flakey, so it panicked on me a few times. In the end, it kinda worked, and the upgrade happened and most things seemed to have worked, except that sound was gone.

So, I tried to make sound work again, because my new boss wants to chat with me over Skype, and it would be a bit pointless without, you know, sound. Somewhere in that process I killed sound completely, and it went from just noise to no noise at all. SO I thought that something was amiss in the upgrade, and so I played around in Synaptic (the package manager) for a while, installing and uninstalling sound stuff. No good results.

Then things got blurry. I got a hint online somewhere to boot into recovery mode and use apt-get from the command line, and run things like dpkg-reconfigure stuff. Well, at some point, and I can't think of where, someone pointed to a major reconfigure of the environment might work, so dpkg-reconfigure * went into action. Ouch, bad move, because when I returned to normal booting, the mouse and keyboard had stopped working. A reboot (well, a crash boot) later and a well-meant dpkg-reconfigure xserver-xorg further killed my graphics card, so now I was at the point of no mouse, no keyboard and no graphics.

I noticed while doing apt-get that it claimed some packages were installed automatically and no longer needed, and told me to uninstall them. Which I did, and before my eyes I saw things like "uninstalling dkpg-*" which is the whole packaging system, which would leave me stranded with a useless system without the tools needed to fix them. A very, very sinking feeling came over me.

However, the brilliant Ubuntu folks have a menu option for just this kind of stupid user actions, called "fixing broken packages" (or something like that). A run of that, and my system got apt-get again. I uninstalled xserver-xorg completely, and reinstalled it, ran the "xserver fix it!" option from the boot menu, and rebooted.

I got my graphics settings back, but still no mouse and keyboard, rebooted into recovery, found one package had been mangled called "udev", uninstalled and reinstalled, run the "xserver fix it!" again plus "apt-reconfigure console ... something", rebooted again with my mouse unplugged (thinking it might be an autodetection problem, and that plugging it in afterwards might reconfigure it properly), got the graphics and the keyboard working, plugged in the mouse which it autodetected and worked, I tapped in username and password, and friggin' VOILA! I was back to where I left off a few days ago.

With no sound.

But hey, at least I got my system back, and if nothing else my Ubuntu / Linux foo has increased, through manual backups and USB mounting and killing processes and linking up dynamic libraries and editing lots and lots of configuration files. Now, if only I can fix that sound, although I'll leave it alone for a few days before I venture down that path. And, I'll burn myself an ISO of my current system right now. Happy, happy.

Update: Got sound working; the rather common pitfall of having your PCM sound set to no sound. Slide it up, and voila! But my microphone is still dead, not sure how to fix that one. Possibly I need to install Windows, boot into it, unclick the mute button there (as it seems the Linux drivers haven't got some access to that), reboot into Linux and kill Windows again. Like, a 2 hour roundtrip because the mute on the microphone might or might not be accessible there. *sigh*

Labels: , ,