The complete guide to installing oss2jack

Prerequisites:

oss2jack requires a udev-based linux distribution: Two that I am familiar with are Ubuntu hoary and Gentoo.

So far, oss2jack has only been tested on i386 linux systems, on both uni-processor and multi-processor systems.

Kernel Headers

Building fusd and the realtime-lsm will require having your kernel headers installed. Gentoo users will already have their headers installed, but most binary distributions do not include headers by default.

With Ubuntu Linux, kernel headers can be installed using apt. For example, if you are running the linux-image-2.6.10-5-k7-smp kernel, you would have to install the linux-headers-2.6.10-5-k7-smp package.

sudo apt-get install linux-headers

Jack Audio Connection Kit

Most modern distributions ship with a working version of the Jack Audio Connection Kit. oss2jack also requires the jack development files to build.

Gentoo:

emerge jack-audio-connection-kit

Ubuntu:

sudo apt-get install jackd libjack0.80.0-dev

Realtime LSM

If you plan on running jackd, oss2jack, and other jack clients as a non-root user, you should install the realtime linux security module. This module will allow users in a particular group (usually the audio group) to lock memory and gain real-time privileges, which is essential for skip-free low-latency audio.

The Realtime LSM requires that capabilities be enabled for your kernel. Most vendor-supplied kernels already have this.

Gentoo:

emerge realtime-lsm

Ubuntu:

Installing non-standard modules can be a little tricky. Ubuntu provides the module-assistant helper application:

sudo apt-get install module-assistant

Next, run the module-assistant app:

sudo module-assistant

First, select the UPDATE menu item to make sure the module-assistant is up to date with the latest information.

Next, select the PREPARE menu item, which will install the packages required to compile kernel modules.

Hit the SELECT menu item, select the realtime-lsm module from the list, and hit OK. From the next menu, select GET, BUILD, and INSTALL in that order.

Ubuntu should now have the realtime-lsm module installed. At this point, if you try to load the module into the kernel, you will get an error (I am not yet sure why). Restart your machine, and everything will be ok.

To configure the realtime-lsm to launch automatically at startup, edit the /etc/ default/realtime file. Ensure that ENABLE=yes and that the gid parameter is the GID of the group you wish to give real-time privileges to. The default of 29 (audio) works well.

Fusd:

Installation

Download and install the hacked version of fusd:

NOTE: If you are using a kernel earlier than 2.6.13, please use fusd-kor-1.10-9.tar.gz.

cd /tmp/
wget http://fort.xdas.com/~kor/oss2jack/fusd-kor-1.10-10.tar.gz
tar xvzf fusd-kor-1.10-10.tar.gz
cd fusd-kor-1.10-10
make
sudo make install

udev configuration

Fusd creates two devices which are used to control it (in this case, by oss2jack). These devices are expected to be found as /dev/fusd/control and /dev/fusd/status. We need to tell udev to put the fusd device files into the /dev/fusd/ device directory. We can do this by placing a line into our udev rules.

Most modern distributions have a special directory that is searched for udev rules. This path (and the permissions path) is specified in the udev configuration file. On Ubuntu, this is at /etc/udev/rules.d/. Rather than editing the main rules file (which could be overwritten by the distribution), it is better to create a new file in the rules directory. Create a file named fusd.rules in your rules directory, containing the following line:

SUBSYSTEM="fusd" NAME="fusd/%k"

If oss2jack is to be run from a user account, that user must have write privileges on the fusd device files. Since this user is part of the audio group, I will configure udev to assign group-write privileges to the audio group. Again, most distributions have a special directory that is searched for permissions files. On Ubuntu, this directory is /etc/udev/permissions.d. Create a file named fusd.permissions in your permissions directory, containing the following lines:

fusd/control:root:audio:660
fusd/status:root:audio:660

Installing the module in the kernel

Now that udev is configured, we can try loading fusd into the kernel.

modprobe kfusd

Your kernel log (dmesg) should have the output: "fusd: registration successful". You should be able to see the fusd files in the /dev/fusd directory:

ls -l /dev/fusd/
total 0
crw-rw----  1 root audio 244, 0 2005-09-17 13:40 control
crw-rw----  1 root audio 243, 0 2005-09-17 13:40 status

If something is wrong, unload the module before retrying:

rmmod kfusd

To load fusd at startup, add 'kfusd' to your list of modules to load on startup. This is usually found at /etc/modules, /etc/modules.autoload, or something along those lines.

oss2jack:

Download and install oss2jack.

cd /tmp/
wget http://fort.xdas.com/~kor/oss2jack/oss2jack-0.24.tar.gz
tar xvzf oss2jack-0.24.tar.gz
cd oss2jack-0.24
./configure
make
sudo make install

Starting up jackd and oss2jack

jack should be started with realtime privileges to eliminate sound skipping and other problems. I start jackd with the following options:

jackd -R -d alsa -d hw:0 -p 64 -r 48000

If you have a slower computer, you may want to increase the period from 64 to 128 or 256. If you have multiple sound cards in your computer, you may have to change the device from hw:0 to hw:1 or hw:2. If you want 'perfect' quality when listening material sourced from CD, consider moving the rate from 48000 down to 44100.

oss2jack doesn't require any special configuration. It will register itself as part of the kernel's sound subsystem, and should be treated like any other sound card by udev. If you wish oss2jack to become the primary OSS provider on your system, make sure no other OSS sound drivers are loaded, particularly snd-pcm-oss:

rmmod snd-pcm-oss

Running oss2jack without any parameters should be sufficient for most configurations:

oss2jack

If you are running other OSS drivers in your kernel, you will have to bind oss2jack to a different device. To bind oss2jack to /dev/dsp3, start oss2jack this way:

oss2jack -n 3

You should now be able to load multiple oss applications and hear the sound forwarded through the jack audio server.