sound init failed (SDL_mixer): No available audio device

The error “sound init failed (SDL_mixer): No available audio device” and how to fix it.

Problem

I started getting the error in the title on the console output when running Sauerbraten, and the sound wouldn’t work no matter what I tried.

Research

As far as I remembered Sauerbraten works fine with ALSA as well as other audio outputs.

Its hardware support comes through SDL (Simple DirectMedia Layer), a game (but not only) library which provides an interface to audio, video, input devices and so on.

I started looking for clues on the net, which turned out some otherwise very useful information about environments variables which affect SDL. But tweaking them didn’t do anything useful.

Eventually, a search through the packages with “sdl” in their name available for Debian cleared the mistery.

Solution

Debian provides no less than 7 (seven) different variants of the SDL library, for different audio drivers. I needed the one with ALSA support (libsdl1.2debian-alsa) or even better, the one with support for everything (libsdl1.2debian-all) but I had the one with OSS support installed (libsdl1.2debian-oss). A memento from the time I last experimented with OSS audio drivers.

If you compile your own SDL, it means you need to compile it with the proper audio driver. There are variants for all the popular sound libraries, including PulseAudio.