Google Ads

February 4, 2015

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

Introduction

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 the support for OSS in the kernel can not be found (you can still compile ubuntu kernel with OSS emulation support). OSS can have both kernel level drivers for actual digital sound processors aka sound cards or can be a user space library provided through wrappers. 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 first two approaches. In the third approach you need to have kernel that has OSS emulation support. The third is the best method for getting most and all OSS applications/games support as it provided by the kernel. Many modern Linux distributions started to use PipeWire multimedia framework for providing sounds support, in this case you need to block/disable PipeWire service whenever you are going to use OSS as PipeWire exclusively uses sound hardware and does not allow sound resource sharing like shown in the last section.

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/libpulsedsp.so

For 64 bit application:

export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/pulseaudio/libpulsedsp.so

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/libpulsedsp.so
./gunman

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

or 

ls -l /dev/dsp1

Optionally, 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 or /dev/dsp1 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

or

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.

Disable PipeWire/PulseAudio on adhoc basis for using OSS

First, install pavucontrol program in Ubuntu/Kubuntu if you already do not have it in the system like shown below for Kubuntu. This program allows controlling Sound system in the desktop.

sudo apt-get remove pavucontrol-qt 

Now open the program PulseAudio Volume Control program as installed and go to the Configuration tab like shown below and uncheck the active profile before using OSS and check it back not using OSS.



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

One final note, as OSS sound volume is not part of modern Linux sound system volume control programs, you need to use alsamixer command in the command like or any other ALSA mixer volume control program to control OSS sound volume as OSS emulation is provided by the ALSA sound system. One such decent graphical ALSA volume control program besides alsamixer is Qasmixer as shown below!




Cheers!
Imam

January 8, 2015

Enrich your Kubuntu 14.10 desktop with plasma widgets

Introduction

Kubuntu operating system uses KDE desktop environment for it's default desktop shell. There are many things you can do with your KDE desktop environment. One of the cool feature of KDE is it's Plasma widgets. Moreover, KDE desktop shell is just a combination of different Plasma widgets and panels. For example, your main application launcher Kickoff is one plasma widget, System tray is another plasma widget containing icons for Wi-Fi, battery, volume etc, Task manager is another plasma widget shows the list of currently running applications. You can easily elaborate your KDE desktop shell by adding additional Plasma widgets to your desktops and panels.


To see and add a widget, right click on the desktop and select Add Widgets. This will bring up widget collection interface where can search for a particular widget as well as see widgets that are currently running on the desktop.




To add a widget to the desktop just drag the particular widget and drop it in the desktop. If you double click on any widget it will be added to the current panel.



KDE widget collection interface

Widgets are adjustable to your needs. If you place your mouse pointer over the widgets then it will bring up a control bar from where you can resize, rotate and change settings of the widgets.


Here is a selection of exciting Plasma widgets for your desktop to try out:


Folder [Installed by default]




As the name suggests, this widget will show the contents of a particular folder right on your desktop. One cool feature of this widget is, it will let you dig into different sub-folders easily just by hovering over them.




Notes [Installed by default]


This is the desktop sticky notes you have been waiting for long time!. It has all the bells and whistles you expect from a general purpose text editor including spell checking. If you constantly take notes while you are working then you will find this widget very helpful.




Analog Clock [Installed by default]


This one handy full featured clock will let you chose different Calender systems from around the world as well as different Time Zones of your interest. Once setup, you can easily see the time from different Time Zones just by scrolling your mouse over the widget.




yaWP


You will not be disappointed by this weather widget. This widget is fancy and interactive. It has all the features from an ideal weather widget including option for showing forecast in different units and changing widget theme.




install yaWP by putting the following command in the terminal:


sudo apt-get install plasma-widget-yawp


Unit Converter [Installed by default]


If you are a person who needs to convert between units regularly then this widget is for you!




SearchMoid


SearchMoid is for searching web right from your desktop. Basically, you type the web address such as www.google.com in SearchMoid and it will open the address in a web browser




install SearchMoid by putting the following command in the terminal:


sudo apt-get install plasma-widget-searchmoid


Shelf [Installed by default]


This widget will let you open different things such as applications, system devices, system tools, etc of your desktop all from one place. This widget is definitely a must have if you want to increase your desktop productivity.




There are many more useful widgets for your comfort installed by default and easily install-able by putting the following command in the terminal:


sudo apt-get install plasma-widget-*