Open Sound System

From ArchWiki
Jump to navigation Jump to search

Template:I18n links start Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n entry Template:I18n links end


The Open Sound System is a commercially-supported sound architecture that works on several UNIX-like and POSIX-compatible systems, including Linux, FreeBSD, Solaris and BeOS/Haiku.

Please note that this article is not about the old OSS, which is included in the Linux kernel sources and is more than 10 years old by now.

This article is about the new OSS versions (often called OSSv4). These versions were previously proprietary - OSS became open source again in July 2007, and is currently available under GPL, BSD or CDDL licenses.

Advantages and disadvantages vs. ALSA

Advantages over ALSA (for users)

  • Includes a transparent software mixer (vmix) in kernel space. This means multiple applications can access the sound device at the same time without problems.
  • The vmix mixer controls allow you to adjust the volume of each application individually.
  • Better support for some sound card models, for example for the Creative X-Fi.
  • Sound quality is usually better. reference needed to validate this statement
  • Better support for applications written for the OSS API, of course. The OSS API is widely spread and a lot of applications support it. The ALSA's OSS API emulation, however, is often buggy.

Advantages over ALSA (for developers)

  • Cleaner and easier to use API.
  • API is much better documented.
  • Support for sound drivers in the userspace (oss_userdev).
  • Portability across all supported platforms. If the application works using OSS under Linux, it will work under FreeBSD and Solaris too, for example.
  • Portability across operating systems. It's easier to port OSS to a new operating system.

Disadvantages vs. ALSA

  • USB audio devices support is currently experimental and USB recording is not implemented.
  • Bluetooth audio devices are currently not supported.
  • AC'97 and HDAudio dial-up soft-modems (for example Si3055) are currently not supported.
  • MIDI support is currently not finished. However, you can still use MIDI with a software synthesizer like timidity or fluidsynth.
  • Suspend is currently not supported. You need to unload OSS (by using Template:Codeline) before suspending, and to reload OSS (by using Template:Codeline) after resuming.
  • Automatic jack sensing currently doesn't work properly with some HDAudio-powered motherboards. This means that, depending on your motherboard model, you may have to manually switch off your speakers when plugging your earphone.


The OSS install script unload all ALSA modules automatically. If it fails for some reason to remove the modules issue the command: modprobe -r soundcore. You should balcklist the ALSA modules (to prevent them loading at boot) by editing Template:Filename as described below.

MODULES=(!soundcore ..............

Install OSS by running:

# pacman -S oss

Be sure the user is part of the audio group:

# gpasswd -a USERNAME audio

Start OSS by running:

# /etc/rc.d/oss start

Add oss to your DAEMONS variable at Template:Filename, so OSS is loaded automatically at each boot.

In the case OSS is not able to detect your card when starting it, run :

# ossdetect -v

Then Template:Codeline to reactivate it.


You can test OSS by running:

$ osstest
Note: Beware the default volume is very loud. Avoid using earphones or lower the volume by using ossxmix.

You should be able to hear music during the test process. If there is no audio, try to adjust the mixer as explained in the following sections and/or read the Troubleshooting sections.

Volume control

To control the volume of various devices, mixers levels will need to be set. The command line mixer is called ossmix. It's very like the BSD audio mixer (mixerctl).

A graphical mixer, is available too. It's called ossxmix. It needs the optional depend gtk2 to work.

The ossxmix controls are explained in the following example:

 / High Definition Audio ALC262 \    ----------------------------------> One tab for each sound card
| [x] vmix0-enable [vmix0-rate: 48.000kHz]      vmix0-channels     \     The vmix (virtual mixer) special configurations
|                                               [ Stereo [v] ]      |--> appear at the top. These include sampling rate
|                                                                  /     and mixer priority. They are provided by OSS.
|  __codec1______________________________________________________  
| |  _jack_______________________________________________________  \     
| | |  _int-speaker____________________  __green_________________   |
| | | |                                | |                          |    These are your sound card configurations.
| | | |  _mode______   | |             | |  _mode______   | |       |    Every mixer control that is shown here is
| | | | [ mix   [v] ]  o o [x] [ ]mute | | [ mix   [v] ]  o o [x]   |--> provided by your sound card. Every sound card
| | | |                | |             | |                | |       |    specific control is shown here.
| | | |________________________________| |_______________________   |
| | |____________________________________________________________   |
| |______________________________________________________________  /
| ___vmix0_______________________________________________________  \
| |  __mocp___  O O   _firefox_  O O  __pcm7___  O O                |    Here are the vmix mixer controls. These are
| | |         | O O  |         | x x |         | O O                |    virtual mixer controls provided by OSS. Each
| | | | |     | x O  | | |     | x x | | |     | O O                |    slider is the volume control of a different
| | | o o [x] | x x  | o o [x] | x x | o o [x] | O O                |--> application. When one application uses the
| | | | |     | x x  | | |     | x x | | |     | O O                |    sound card, its name is shown in the place of
| | |_________| x x  |_________| x x |_________| O O                |    the 'pcm#' labels. There are also sound level
| |______________________________________________________________   |    meter levels for each application.
|________________________________________________________________  /

Jack Definitions

For high definition audio, ossxmix will highlight the jacks to their corresponding plug color. For 5.1 surround sound the jack colors are:

Connector Type Purpose OSS
green TRS 3.5mm stereo output, front channels front
black TRS 3.5mm stereo output, rear channels rear
grey TRS 3.5mm stereo output, side channels side
gold TRS 3.5mm dual output, center and subwoofer center/LFE
blue TRS 3.5mm stereo input, line level input
pink TS 3.5mm mono microphone input input

For the most part and for most people just make sure that:

  1. All green jacks (green and fp-green) are "front" and 75% from max volume.
  2. All pink jacks (pink and fp-pink) are input and 50% of max to avoid distortion.

Other Mixers

Other desktop environments may have support for OSS:

  • Gnome - Gnome Volume Control has support for OSS. Some users report that using Gnome Volume Control is easier to setup than ossxmix.
  • KDE - Kmix now has preliminary support for OSS.

Saving and restoring mixer settings

If you wish to save your mixer settings manually, run Template:Codeline. As regular user you will need permissions to use Template:Codeline in the sudoers file or you can modify write permissions to Template:Filename. Alternately, the -f switch can be used to save the mixer to a file and Template:Codeline to restore it.

Please note that the init scripts run these commands before shutdown/after starting to keep mixer settings across boot, so most users don't need to worry about it.

Configuring Applications for OSS


The skype package only includes support for ALSA. To get an OSS-capable Skype, install the skype-oss package:

# pacman -S skype-oss

If you are using x86_64, you can get the bin32-skype-oss package from AUR.


  • Run winecfg.
$ winecfg
  • Go to the Audio tab.
  • Select OSS Driver.


By default Gajim uses Template:Codeline to play a sound. To change this go in Advanced Settings and search for the Template:Codeline variable. The ossplay program included in the oss package is a good replacement:



To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice= /dev/ossmix in your config (located in /home/yourusername/.moc). And now MOC should work with OSS v4.1. Or you can compile moc-svn package from AUR (he got support for new vmix). For issue with interface change OSSMixerChannel = to OSSMixerChannel = Any channel and after start mocp press w (change to sofware mixex) that will help and you can change the volume power.

Applications that use Gstreamer

Remove pulseaudio and gstreamer*-pulse programs and libraries.

To change the gstreamer setting to output the sound to OSS instead of the default ALSA, run:


Change the Default Output plugin to custom and the change the pipeline to:


For the input:

Note: It's not certain that the input will sound better with oss4src compared to osssrc, so change this only if it improves your input sound. < confirmation on this please >

If you are using phonon with the gstreamer backend you will need to set the environmental variable. To add to your current user:

export PHONON_GST_AUDIOSINK=oss4sink

Add this to your Template:Filename to be loaded on login.

Firefox >=3.5

Firefox 3.5 introduces the <video> and <audio> tag support and can play ogg media out of the box. However, it currently can't be compiled with ALSA and OSS support at the same time. So you need to install the xulrunner-oss package.

1. Stop firefox.
2. Remove the xulrunner package without dependency check: sudo pacman -Rd xulrunner
3. Install xulrunner-oss package from AUR using yaourt or ABS.
4. Start firefox.


If you are using gui (smplayer etc.) you will find the oss output at the audio settings. Using on cli you should specify the sound output: mplayer -ao oss /some/file/to/play.mkv If you don't want to brother typing it over and over again add "ao=oss" to your config file. (/home/$USER/.mplayer/config)

Other applications


Troubleshooting HDAudio devices

Understanding why problems arise

If you have a HDAudio sound device, it's very likely that you will have to adjust some mixer settings before your sound works.

HDAudio devices are very powerful in the sense that they can contain a lot of small circuits (called widgets) that can be adjusted by software at any time. These controls are exposed to the mixer, and they can be used, for example, to turn the earphone jack into a sound input jack instead of a sound output jack.

However, there is a side effect, mainly because the HDAudio standard is more flexible than it perhaps should be, and because the vendors often only care to get their official drivers working.

Then, when using HDAudio devices, you often find disorganized mixer controls, that doesn't work at all by default, and you are forced to try every mixer control combination, until it works.

How to solve

Open ossxmix and try to change every mixer control in the middle area, that contains the sound card specific controls, as explained in the previous "The mixer" section.

You'll probably want to setup a program to record/play continously in the background (e.g. Template:Codeline for recording or Template:Codeline for playing), while changing mixer settings in ossxmix in the foreground.

  • Raise every volume control slider.
  • In each option box, try to change the selected option, trying all the possible combinations.
  • If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.

Please note again that you do not need to change any controls in the top area nor in the bottom area, as they are virtual vmix-related mixer controls.

  • Editing Template:Codeline uncommenting and changing hdaudio_noskip=0 to a value from 0-7 can give you more jack options in ossxmix

I had to edit mine to hdaudio_noskip=7 for my sub/rear speaker to work on my laptop, restart oss for the changes to take effect Template:Codeline

MMS sound cracking in totem

If your stream sounds with cracks or strange noise in totem like it did with me then you could try to play it with another backend like ffmpeg (mplayer). That "fixed" the issue for me. This will not fix the issue that somehow pops up in gstreamer when playing MMS streams but it will give you the option to play it with good sound quality. Playing it in mplayer is simple:

# mplayer mmsh://yourstreamurl

Microphone playing through output channels

OSS by default plays back the microphone through the speakers. To disable this in ossxmix find the misc section. Check off every "input-mix-mute" to disable this.

Troubleshooting other issues

  • If you get distorted sound, try lowering some volume control sliders.
  • If you need to change the default sound card, look at here.
  • If you have another issues, try searching or asking for help at the 4front forums.

Tips and Tricks

Using multimedia keys with OSS

An easy way to mute/unmute and increase/decrease the volume is to use the Template:Codeline script available in AUR.

Once you installed it try to toggle the sound:

$ ossvol -t

Type Template:Codeline for the other commands.

If you don't know how to assign commands to your multimedia keys, see Extra Keyboard Keys.

Template:Codeline troubleshooting

If you get an error like:

Bad mixer control name(987) 'vol'

you need to edit the script (Template:Filename) and change the value of the Template:Codeline variable which is at the beginning of the script. For example mine is Template:Codeline.

  • Note if you are using xbindkeys for your multimedia keys adding this
"ossmix vmix0-outvol -- +1"

raise volume

"ossmix vmix0-outvol -- -1"

lower volume

to the raise/lower volume section of your .xbindkeysrc file is an easy way to adjust the volume

Changing the Sample Rate

Changing the output sample rate is not obvious at first. Sample rates can only be changed by the superuser and vmix must be unused by any programs when a change is requested. Before you follow any of these steps, ensure you are going through a receiver/amplifier and using quality speakers and not simply computer speakers. If you are only using computer speakers, don't bother changing anything here as you won't notice a difference.

By default the sample rate is 48000hz. There are several conditions in which you may want to change this. This all depends on your usage patterns. You want the sample rate you are using to match the media you use the most. If your computer has to change the sampling rate of the media to suit the hardware it is likely, though not guaranteed that you will have a loss in audio quality. This is most noticable in downsampling (ie. 96000hz → 48000hz). There is an article about this issue in "Stereophile" which was discussed on Apple's "CoreAudio API" mailing list if you wish to learn more about this issue.

Some example sample rates:

  • 44100hz - Sample rate of standard Red Book audio cds.
  • 88000hz - Sample rate of SACD high definition audio discs/downloads. It is rare that your motherboard will support this sample rate.
  • 96000hz - Sample rate of most high definition audio downloads. If your motherboard is an AC'97 motherboard, this is likely to be your highest bitrate.
  • 192000hz - Sample rate of BluRay, and some (very few) high definition downloads. Support for external audio reciever equipment is limited to high end audio. Not all motherboards support this. An example of a motherboard chipset that would support this includes Intel HDA audio.

To check what your sample rate is currently set to:

  1. Run "ossmix | grep rate".

You are likely to see "vmix0-rate <decimal value> (currently 48000) (Read-only)".

If you do not see a "vmix0-rate" (or "vmix1-rate", etc.) being outputted, than it probably means that vmix is disabled. In that case, OSS will use the rate requested by the program which uses the device, so this section doesn't apply. Exception: envy24(ht) cards have a setting envy24.rate which has a similiar function (see "oss_envy24" manpage). You can follow these steps, but at step 2, change with ossmix the value of "envy24.rate" as well.

Steps to affect the change:

  1. First, make sure your card is able to use the new rate. Run "ossinfo -v2" and see if the wanted rate is in the "Native sample rates" output.
  2. As root, run "/usr/lib/oss/scripts/". Be aware, this will close any program that currently has an open sound channel (examples being media players, Firefox as of 3.5 if you have xulrunner-oss installed, and the gnome volume control).
  3. After all programs occupying vmix are terminated, run as root: "vmixctl rate /dev/dsp 96000" replacing the rate with your desired sample rate.
  4. Run "ossmix | grep rate" and check for "vmix0-rate <decimal value> (currently 96000) (Read-only)" to see if you were successful.

A simple systray applet

Want a applet to control volume like in GNOME? Form here I got a usable one.

Download this script and rename whatever you want, e.g.: ossvolctl. run the following command:

$chmod +x ossvolctl
#cp ossvolctl /usr/bin/ossvolctl


#install -Dm755 ossvolctl /usr/bin/ossvolctl

Start ossxmix docked to systray on startup


Create an application launcher file named ossxmix.desktop in you local application launchers directory (~/.local/share/applications/ then enter:

[Desktop Entry]
Name=Open Sound System Mixer
GenericName=Audio Mixer
Exec=ossxmix -b

To add it to autostart when loading the desktop environment:

System Settings > Advanced tab > Autostart. Then click add program and choose it from the 'Multimedia' list.


  • As Root create a file /usr/local/bin/ossxmix_bg with the following content:
exec /usr/bin/ossxmix -b

Goto System > Preferences > Start Up Applications

  • Click Add, Type OSSMIX in Name field and /usr/local/bin/ossxmix_bg in Command field then click Add button.
  • Login and Logout to see the changes.

Record sound output from a program

Suspend and Hibernation

OSS does not automatically support suspend meaning that OSS must be manually stopped prior to suspending or hibernating.

OSS provides soundon and soundoff to enable and disable OSS, although any processes that use sound must be terminated first.

The following script is a rather basic method of automatically unloading OSS prior to suspending and reloading afterwards.




case "$1" in
 *) exit $NA

Save the contents of the script (as root) into Template:Filename and make it executable. Template:Filename

Note: This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.

OSS does not support suspending but we don't care or better s2ram works fine without stopping OSS. Just create a nice suspend script to /sbin/suspend and make it executable.


 if [ [ $EUID -ne 0 ] ]; then
 ## Checking if you are a root or not
   echo "This script must be run as root" 1>&2
   exit 1

 s2ram -f

 sleep 2

 /etc/rc.d/oss restart 2>/tmp/oss.txt

 if [ $? -gt 0 ]; then
 echo "OSS restart failed check /tmp/oss.txt for advice"

 exit 0

That's all your apps are fine and suspend works. \o/

Note: If you are using Opera you must kill operapluginwrapper before suspend. To do this add PID=`pidof operapluginwrapper`;kill -9 $PID before s2ram -f.

ALSA emulation


You can instruct alsa-lib to use OSS as its audio output system. This works as a sort of ALSA emulation.

Note, however, that this method may introduce additional latency in your sound output, and that the emulation is not complete and doesn't work with all applications. It doesn't work, for example, with programs that try to detect devices using ALSA.

So, as most applications support OSS directly, use this method only as a last resort.

In the future, more complete methods may be available for emulating ALSA, such as libsalsa and cuckoo.


  • Install the alsa-plugins package.
# pacman -S alsa-plugins
pcm.oss {
   type oss
    device /dev/dsp

pcm.!default {
    type oss
    device /dev/dsp

ctl.oss {
    type oss
    device /dev/mixer

ctl.!default {
    type oss
    device /dev/mixer
Note: If you don't want to use OSS anymore, don't forget to revert changes that you do here in Template:Filename.

Experimental packages

Mercurial repository version

There is a oss-mercurial package in AUR. This package compiles and installs the latest OSS development version direcly from the Mercurial repository.

You can try this package if you want to contribute code to OSS or if only a very recent change in OSS code introduced support to your sound device.

If you want oss to take care of your flash sound you will need to install libflashsupport:

# pacman -S libflashsupport