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.

The third approach using OSS driver emulation

In this approach ALSA sound system could provide OSS driver emulation through kernel modules. First, make sure you are not using first two approaches (easy and second). And then make sure the system has alsa-oss package installed and other associated packages for 32 bit alsa oss support. Then load the oss kernel modules by executing the following commands:

sudo modprobe snd_pcm_oss
sudo modprobe snd_mixer_oss
sudo modprobe snd_seq_oss

Then check that the modules are loaded using the following command:

sudo lsmod | grep oss

You should be able to see snd_pcm_oss, snd_mixer_oss and snd_seq_oss in the output. Finally, check that your system has dsp device file in the dev folder by executing the following command:

ls -l /dev/dsp


ls -l /dev/dsp1

if you somehow have /dev/dsp1 not /dev/dsp then create a symbolic link for /dev/dsp by executing the following command:

sudo ln -s /dev/dsp1 /dev/dsp

Now, most OSS games should work as they have access to /dev/dsp sound card device file. Some games would still not work since they like to have direct access to OSS sound system. You can make them work by executing the following command from root:

su -

echo et.x86 0 0 direct > /proc/asound/Generic/pcm0p/oss


su -

echo 'kingpin.x86 0 0 direct' > /proc/asound/card0/pcm0p/oss

In the above command et.x86 is the game executable and /proc/asound/Generic/pcm0p/ or /proc/asound/card0/pcm0p/ is the oss file location depending on your system.

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


1 comment: