Google Ads

February 4, 2015

Get Open Sound System (OSS) applications and games working in modern Linux distributions


Open Sound System (OSS) is an obsolete sound system for GNU/Linux used by many old 32 bit games and applications. In recent modern Linux distributions such as Ubuntu/Kubuntu 14.10 the support for OSS in the kernel can not be found. OSS can have both kernel level drivers for actual digital sound processors aka sound cards or can be a user space library. OSS provides an interface for applications to make use of sound devices.

Now, instead of rebuilding the Linux kernel with OSS support, we can easily get OSS working by just installing few packages from the standard Ubuntu repository as shown in the following approaches.

The easy approach using a wrapper library

This approach is the easiest and recommended as this works on most recent Linux distributions i.e. Ubuntu 20.10. Furthermore, this approach allows applications using OSS blend well with the modern applications using 
PulseAudio as OSS applications will become part of the PulseAudio sound system. In this approach, we will have to preload a wrapper library to transfer OSS calls to equivalent calls provided by the Linux defacto sound server PulseAudio. To achieve this, open up the terminal and install the libpulsedsp packages by putting the following command:

sudo apt-get install libpulsedsp:i386 libpulsedsp

Now, we can preload the PulseAudio OSS wrapper library using the following BASH command into the terminal:

For 32 bit application:

export LD_PRELOAD=/usr/lib/i386-linux-gnu/pulseaudio/

For 64 bit application:

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/pulseaudio/

For instance, if I have a game executable called "gunman" I would do the following in the terminal to get OSS working in the game:

export LD_PRELOAD=/usr/lib/i386-linux-gnu/pulseaudio/

The second 
approach using PulseAudio OSS daemon

PulseAudio OSS daemon works like actual OSS by providing actual sound card device files i.e. /dev/dsp that applications can directly access to. This approach might need elevated system permission to function as in the original OSS. Thus, using this approach once the OSS daemon is started OSS applications have direct access to the device file which might not allow multiple OSS applications to get the sound working like the original OSS. Also, system resource requirements would increase using this approach as the daemon has to run in the background waiting for the intercepting OSS calls. This approach is only recommended when the easy approach does not work.

Open up the terminal and install the osspd and osspd-pulseaudio packages by putting the following command:

sudo apt-get install osspd osspd-pulseaudio

Finish installing packages. Now you can reboot the computer or start the service that provides OSS support by putting the following command in the terminal:

sudo service osspd start

check weather OSS service running by the following command:

sudo service osspd status

You should find  * osspd is running output in the terminal.

And finally, now check weather OSS is actually working by the following command:

cat /dev/urandom > /dev/dsp

You should hear white noise. Stop the noise by pressing Ctrl + C keys together in the terminal.

Now, you can hear sound from many old applications which require OSS for sound.