Tuesday, October 9, 2012

The sound of silence

So far, everything went about as well as could be expected. That changed when I tried to get sound working.

After I got Firestorm installed, and poked around with it a while, I broke away to take care of other things, like dinner. By now, my roommate had woken up. I mentioned that I hadn't tried sound, and he pointed out that he had put a pair of speakers near the new machine to use for testing. I went back downstairs and hooked them up.

The good news is that Firestorm's own sounds worked well with the default configuration.
The bad news is that streaming music is an unmitigated mess.

I should point out here that Second Life allows each parcel of virtual land to have a Shoutcast stream URL associated with it. This is most commonly used for the purpose I wanted it: to be able to go to a club and listen to a set spun by a DJ. My friend Avril Korman, better known as DJ Bronxelf or by her inworld name Axi Kurmin (and no, I'm not giving away any secrets; she publicizes it herself) runs one such club by the name of Gothika. It was watching my roommate there that first got me to thinking about a new machine.

On Windows or OS X, this Just Works: you go to the club, and when the DJ starts the set, you click on an icon of two musical notes, Firestorm connects to the Shoutcast stream, and the music starts playing. On a 64-bit Linux system, this is a major nightmare. It turns out that Firestorm is a 32-bit application; it can be built as 64-bit, but that takes serious hackery. This is why the 32-bit libraries needed installing. The problem is that Firestorm and all other Second Life viewers use gstreamer on Linux to do this job, and apparently gstreamer has its own set of weirdnesses.

Firestorm is built with support for both OpenAL and FMOD. OpenAL is used by default, but you can force it to be turned off by uncommenting one line in the shell script that launches the viewer. With OpenAL, Firestorm's built-in sounds, and sounds not coming from a stream, work fine, but streaming audio is totally silent. With OpenAL disabled, falling back to FMOD (which uses version 3.75, old enough that it's no longer available for download), the streaming audio works, but the other sounds are badly lagged. Very badly. As in they are heard over a minute after the event that should be triggering them.

All right, so I can deal with that by kludging around it: I could open the stream URL in the Banshee media player and listen that way, leaving Firestorm set to use OpenAL for its own sounds. That led to another problem, though. The sound from Banshee was very, very loud, and the sound from Firestorm was not. If I set the system master volume to make Firestorm audible at my preferred level, Banshee badly overdrove the speakers.

"Turn down the volume control on Banshee", I hear you saying. Yeah, that's what I thought, too. I finally found Banshee's volume control after an hour: I tripped over it while I was looking at every display on the program. It turns out that the volume control is only accessible from the "Now playing" screen, which doesn't make a lot of sense to look at when playing a stream.

Still, I got it all evened out and usable, and went to the set before Bronxelf's. (Hers is at midnight US Central, and I don't usually stay up that late.) That took turning Banshee's audio output all the way down to 11%. Firestorm performed well, and overall I was happy.

But still, it wasn't Just Working, as I have come to expect. So this morning, I went back to poking at it. What I found is that sound on Linux is an unholy mess. OSS and OpenAL and ALSA and PulseAudio and bears, oh my! I don't know what's current, what's deprecated, what's supposed to work, what's not, what's the intended way to get things running, and what's an unholy kludge.

I do know what works: nothing.

I spent the day piddling and trying different configuration parameters and rebooting and tweaking and got exactly nowhere. The most promising approach, the one my roommate uses to get it working on his Ubuntu 12.04 system, consists of running Firestorm with FMOD under the control of another program, padsp. That didn't work: Firestorm refused to start because it couldn't preload the library that padsp places in the environment to do the magic. Nothing else I tried could get it to quit lagging with FMOD or to produce streaming audio with OpenAL.

Yes, I know that FMOD 3.75 is old, old, old. It's still what we have to work with. It Just Works on Windows and OS X. It should Just Work on Linux. Linden Lab is starting to work on integrating FMODEx 4.whatever into the viewer; this is not a straight drop-in, as the APIs changed. That doesn't change the fact that, for this purpose, Linux does not fail to suck.

I'll probably stick with the OpenAL/Banshee configuration for now. At least that way, the sounds I'm used to getting as I use the viewer happen when I expect instead of enough later that I wonder what the hell I clicked to make it make that noise.


  1. Linden Lab should bite the bullet and do a 64-bit Linux build. It's possible; Imprudence/Kokua do it, but Kokua isn't out yet, alas, and Imprudence is based on the 1.x client.

    That said, you *can* head over to https://bitbucket.org/ArminW/teapot/wiki/Home and grab the 64-bit Linux build of Armin Weatherwax's "Teapot" SL client. It works like a charm on Ubuntu 12.04, including streaming media.

  2. If I was going to do that, I'd just rebuild Firestorm. I may do so anyway.

    I'm not sure why LL won't do 64-bit Linux builds. I do know that they have to be standalone builds, not using the libraries LL supplies, but rather the system libraries. Maybe they decided they don't need the support headaches.