Open Sound System

From ArchWiki
Revision as of 15:05, 10 September 2009 by Markg85 (Talk | contribs) (ALSA emulation should be a last resort so make that clear rather then just a line noting that.)

Jump to: navigation, 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 version 4 is an alternative sound architecture for Unix-like and POSIX-compatible systems. It has commercial support by 4front technologies and is provided under the GPL, BSD, or CDDL licenses.

This article will focus only on configuration and use, Wikipedia has a great article if you wish to know more about the history of this software.


Both sound systems for Linux have their advantages and disadvantages. Some will work on some hardware while not on others. Below is a brief comparison between the two audio systems.

OSS Advantages ALSA Advantages
  • User Advantages
    1. Includes a transparent software mixer in kernel space. This allows multiple programs to access the sound device without knowledge of any other program.
    2. The build in software mixer (ossmix and ossxmix) allows you to individually control the volume of any program.
    3. Some allege that the sound quality is better. There exist however no citations for this.
    4. Native support for the OSS API. A result of this is not needing to use an emulation layer with ALSA to get OSS only programs to work.
  • Developer Advantages
    1. Cleaner and Easier API
    2. Cleaner Documentation
    3. Support for drivers in user-space through oss_userdev.
    4. Increased portability as OSS functions on BSD and Solaris in addition to Linux.
    5. More future portability as it is easier to port to a new operating system as evidenced by the Haiku port.
  • Advantages
    1. Better support for USB audio devices.
      With OSS output is experimental, input is not supported.
    2. Support for Bluetooth audio devices.
    3. Support for AC'97 and HDAudio dial-up soft-modems such as Si3055.
    4. Better support for MIDI devices.
      You can still use MIDI with OSS through a software synthesizer such as Timidity or Fluidsynth.
    5. Proper support for suspend.
      OSS must be unloaded using Template:Codeline prior to suspension. This has a side effect that any sound producing program must be closed. Upon resumption you may reload OSS using Template:Codeline.
    6. Better support for automatic audio jack sensing. OSS lacks support for this on some HD audio motherboards. If affected by this you will have to manually switch off your speakers when you plug in your earphones.


  1. Since ALSA is enabled by default in Linux 2.6 we need to explicitly disable it for it not to conflict with OSS.
    1. As root, open Template:Filename.
    2. Append Template:Codeline to the Template:Codeline array. Eg: Template:Codeline
    3. Reboot to ensure ALSA is disabled.
  2. If you use flash you must install libflashsupport.
    1. Template:Codeline
  3. Any user that wishes to output sound must be part of the audio group. To add your user to the audio group:
    1. As root run: Template:Codeline
    2. To start OSS for this session run as root Template:Codeline
  4. To enable OSS at every boot:
    1. As root, open Template:Filename.
    2. Append Template:Codeline to the Template:Codeline array. Eg: Template:Codeline
  5. In the case OSS is not able to detect your card when starting it:
    1. As root, run Template:Codeline.

Experimental Mercurial Package

Warning: Try not to use the experimental packages if at all possible, they can cause serious headaches.

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.


While you could simply play audio through your favourite audio program, there exists a command to test whether or not OSS is functional. Run osstest as a normal user for OSS to play a short audio file through each of the channels in turn. Be advised this may be loud, so either turn down your speakers or take off your headphones. If you do not hear any audio on a channel you may have to reconfigure your settings.


Before we continue to the configuration of your sound system there is some terminology that we should define first to make things a little more straight forward.

Virtual Mixer

Virtual Mixer or vmix for short, is a piece of software that takes many audio sources and combines them together in real time. By default the vmix is enabled in OSS, however you can opt to turn it off.

See Also


A Jack is a surface mounted connector in which you connect a cord or plug to. In computer audio you can have several different jacks on the computer.

The following are the jack definitions as per Wikipedia. With the exception of the S/PDIF jacks, if you own a HD audio device the functions of the jacks can be redefined as you wish. The following is simply a historical guideline.

Plug Type Jack Colour # of Channels Channels Notes
TRS 3.5mm green 2, stereo front
TRS 3.5mm black 2, stereo rear
TRS 3.5mm grey 2, stereo side
TRS 3.5mm gold 2 center/LFE
TRS 3.5mm blue 2, stereo input line level input
TS 3.5mm pink 1, mono input microphone input
Optical Toslink S/PDIF N/A 2-6
  • 2 channel - uncompressed PCM
  • 6 channel - compressed Dolby or DTS.
  • Dolby or DTS is pass-through only. One source of this compressed audio is a video DVD.
  • This output is locked to the front channels.
Coax S/PDIF N/A 2-6
  • 2 channel - uncompressed PCM
  • 6 channel - compressed Dolby or DTS.
  • Dolby or DTS is pass-through only. One source of this compressed audio is a video DVD.
  • This output is locked to the front channels.

See Also

HD Audio Devices

Modern audio circuitry is based around a lot of small circuits (termed 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.

An unfortunate side effect of this flexibility is when using HD audio devices, you often find disorganized mixer controls. They have a tendency to not work at all by default, and you are forced to try every mixer control combination, until it works.

See Also

Configuring OSS

Choosing your Mixer

There are several mixers avaliable for OSS. These include:

  • ossmix: The command line mixer, with this you do not need X11. If you are familiar with BSD's Template:Codeline this will be familiar to you.
  • ossxmix: The GTK2 based GUI mixer. You need to have Gtk2 installed to use this. This program can be overbearing at first, however it provides access to all the mixer properties. Other GUI mixers may only provide access to the master volume control.
  • Gnome Volume Control: An easy, simple, volume control.
  • Kmix: A volume control for KDE.

The below configuration will solely use Template:Codeline.

There are four primary sections to Template:Codeline. From top to bottom they are:

  • Vmix primary controls.
    • A display of the current sample rate. You cannot change the sample rate through ossmix.
    • Whether you have a multi-channel setup or simply stereo. If you do not choose multi-channel you will be unable to specify the other channels at all.
    • The quality level of the virtual mixer.
  • Jack configuration.
    • Which channels the jack outputs.
    • Volume controls for each channels on each jack.
  • Channel configuration.
    • Whether certain channels are muted.
    • Whether the microphone is played back through those channels in real time.
  • Process Specific Controls
    • Mute or change the volume of specific processes.

Vmix Primary Controls

  1. If you wish to do multi-channel instead of stereo you must choose this here before anything else.
  2. Set the quality to "Production", there does not appear to be any measurable change in CPU usage with this setting.

Jack Configuration

The first thing you must do is set what each jack actually does. OSS provides the colours for each jack, you must choose from a pop-up menu what that jack does. You can use the following table to know the standard historical settings.

Plug Type Jack Colour # of Channels Channels Notes
TRS 3.5mm green 2, stereo front
TRS 3.5mm black 2, stereo rear
TRS 3.5mm grey 2, stereo side
TRS 3.5mm gold 2 center/LFE
TRS 3.5mm blue 2, stereo input line level input
TS 3.5mm pink 1, mono input microphone input

For the most part you are safe setting everything at their maximum values. The one exception is any input channel. It is recommened to have these at 50% to have as little distortion as possible. Remember to keep the microphone a decent distance from your mouth to avoid distortion as well.

HD Audio Device Troubleshooting

Because of the complexity of HD Audio devices there can be times where they do not configure themselves. If the above chart does not help with setting what channels should go on what jacks we will have to configure OSS the hard way.

  1. Open Template:Codeline and a terminal window.
  2. In Template:Codeline raise every volume control slider.
  3. In each option box, try to change the selected option, trying all the possible combinations.
  4. If you get noise, try to lower and/or mute some volume controls, until you find the source of the noise.
    • At this time you do not need to change any controls in the Vmix Primary Controls nor in the channel or process areas, as they do not affect the port configurations.
    • Editing Template:Filename uncommenting and changing Template:Codeline to a value from 0-7 can give you more jack options in ossxmix. Restart oss for the changes to take effect with Template:Codeline

Channel Configuration

Very little configuration is needed for individual audio channels as they are fine by default. We do want to mute the microphone in these channels so make sure to check off "input-mix-mute" on every channel.

Process Specific Controls

There is no reason to change these at this moment, however if one program has output that is too loud and you wish to lower its volume you can do so here in the future.

Manually Saving and Restoring Mixer Settings

Normally you shouldn't have to manually save your settings but you can if you wish. To save the settings you need permission to modify Template:Filename. You can accomplish this in several ways:

  1. You can be in the same group as the file with group write permissions.
  2. You can modify sudoers to allow you to run Template:Filename as root.

To save your mixer settings:

  1. Run Template:Codeline. If you wish to safe to a specific file run Template:Codeline.

To restore mixer settings:

  1. Run Template:Codeline.

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 Template:Codeline.

You are likely to see Template:Codeline.

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 Template:Filename. 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: Template:Codeline replacing the rate with your desired sample rate.
  4. Run Template:Codeline and check for Template:Codeline to see if you were successful.

Suspend and Hibernation

OSS does not natively support suspension. It is still possible to suspend your computer, however OSS and any program using sound must be closed prior to suspension.

Use soundon and soundoff to enable and disable OSS respectively. Use Template:Codeline to terminate any process that has an open sound connection.

To enable simple suspend and resumption use the following power management script:

  1. Open/Create Template:Filename as root.
  2. Make this file executable by running Template:Codeline
  3. Set the contents of this file to the following:



case "$1" in
    *) exit $NA
Warning: This script is rather basic and will terminate any application directly accessing OSS, save your work prior to suspending/hibernating.

ALSA emulation

Warning: Most applications support OSS directly, use this method only as a last resort!

You can instruct Template:Codeline 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.

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

  1. Install the alsa-plugins package with Template:Codeline
  2. Open Template:Filename as root.
  3. Append:
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 /etc/asound.conf.

See Also

Multimedia Keys


A simple way to mute/unmute/increase/decrease the volume is to use the ossvol package. Once the package is installed:


Bad mixer control name(987) 'vol'
  1. As root open Template:Filename.
  2. Change the value of the CHANNEL variable which is at the beginning of the script. For example mine is Template:Codeline.


If you are using xbindkeys for your multimedia keys, you can use the following commands:

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

Configuring Applications for OSS

Other programs need various attention to work with OSS.


Flash within Firefox supports OSS through the libflashsupport library that is automatically installed. Firefox 3.5 has introduced the <video> and <audio> tags and can play ogg media out of the box. Unfortunately however Firefox currently can't be compiled with ALSA and OSS support at the same time. So you need to install the xulrunner-oss package.


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 switch all gstreamer programs from using ALSA to OSS:

  1. Make sure that pulseaudio and gstreamer*-pulse programs and libraries are uninstalled.
  2. Run Template:Codeline to open the settings program. We must determine which setting is right for you as some combinations works for some but not others.
    • Default Output
    1. Change the default plugin to "Custom" with a pipeline of "oss4sink".
    2. Run Template:Codeline to check and see if you can play audio through gstreamer. If it works, skip to default input, if not, continue.
    3. Change the default plugin to "OSS - Open Sound System".
    4. Run Template:Codeline to check and see if you can play audio through gstreamer. This fallback should work if you have OSS installed properly.
    • Default Input
    1. Change the default plugin to "Custom" with a pipeline of "oss4src".
    2. Run Template:Codeline to check to see if you can record your voice. If this works you are done configuring Gstreamer, else continue.
    3. Change the default plugin to "OSS - Open Sound System".
    4. Run Template:Codeline to check to see if you can record your voice. This fallback should work if you have OSS installed properly.


To use MOC with OSS v4.1 you must change section OSSMixerDevice to OSSMixerDevice=/dev/ossmix in your config (located in Template:Filename). 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.


If you are using phonon with the gstreamer backend you will need to set an environmental variable. To do so:

  1. Open Template:Filename
  2. Append Template:Codeline or Template:Codeline depending on what you chose above.


The normal Skype package only includes support for ALSA. Install skype-oss on i686 or bin32-skype-oss on x86_64.


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:

  1. Template:Codeline


To enable OSS sound in wine:

  1. Run Template:Codeline
  2. Select the Audio tab.
  3. Select the OSS driver.

See Also

There are several other places you can look for OSS compatible packages.