* Better support for applications that use the OSS API and do not support ALSA's native API. Many applications still use this API, and do not require an emulation layer like ALSA uses.

=== OSS Advantages (developers) ===

=== OSS Advantages (developers) ===

Line 29:

Line 28:

* Support for suspend.

* Support for suspend.

* Better support for jack detection.

* Better support for jack detection.

−

* Better support for applications that use the ALSA API and do not support the OSS API.

{{Note|

{{Note|

Revision as of 12:12, 1 November 2012

The Open Sound System (or OSS) is an alternative sound architecture for Unix-like and POSIX-compatible systems. OSS version 3 was the original sound system for Linux, but was superseded by the Advanced Linux Sound Architecture (or ALSA) in 2002 when OSS version 4 became proprietary software. OSSv4 became free software again in 2007 when 4Front Technologies released its source code and provided it under the GPL license.

Install

This will install the OSS files and run the OSS install script that will temporarily disable the ALSA modules, and install the OSS kernel modules. Since ALSA is enabled by default in the boot scripts, you need to disable it so it does not conflict with OSS when booting. You can do this blacklisting the module:

You should be able to see your devices listed under Device objects or Audio Devices. If the device that you want to use is not at the top on Audio devices or Device objects sections, /usr/lib/oss/etc/installed_drivers needs to be edited. The driver for the device that needs to be used should be at the very top. It may be required to do a:

$ soundoff && soundon

If this does not work, comment all drivers listed that are not your preferred device.

Volume Control Mixer

To control the volume of various devices, mixers levels will need to be set. There are two mixers. One is a command line mixer called ossmix. This one is very like the BSD audio mixer (called mixerctl).

The second mixer is a graphical mixer called ossxmix and will require gtk2 to be installed to run it.

The vmix (virtual mixer) special configurations appear at the top. These include sampling rate and mixer priority.

These are your sound card jack configurations (input and output). Every mixer control that is shown here is provided by your sound card.

Application vmix mixer controls and sound meters. If the application is not actively playing a sound it will be labeled as pcm08, pcm09... and when the application is playing the application name will be shown.

Color Definitions

For high definition (HD) audio, ossxmix will color jack configurations by their pre-defined jack colors:

Color

Type

Connector

green

front channels (stereo output)

3.5mm TRS

black

rear channels (stereo output)

3.5mm TRS

grey

side channels (stereo output)

3.5mm TRS

gold

center and subwoofer (dual output)

3.5mm TRS

blue

line level (stereo input)

3.5mm TRS

pink

microphone (mono input)

3.5mm TS

Saving Mixer Levels

Mixer levels are saved when you shut off your computer. If you want to save the mixer level immediately, as root:

# savemixer

savemixer can be used to write mixer levels to a file with the -f switch and restore by the -L switch.

Default Channel: vmix0-outvol (find out what channel to use from ossmix)

Default Mixer: ossxmix

Tab MiniMixer (optional): vmix0-outvol and optionally others.

Configuring Applications for OSS

Skype

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

Wine

To set OSS support in Wine:

Run winecfg.

$ winecfg

Go to the Audio tab.

Select OSS Driver.

Gajim

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

MOC

To use MOC with OSS v4.1 you must change OSSMixerDevice to /dev/ossmix in your config (located in ~/.moc).

Alternatively, you can use the moc-svnAUR package from the AUR that has OSS support. For issues with the interface try changing the OSSMixerChannel: press 'w' in mocp (to change to sofware mixer).

Applications that use Gstreamer

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

$ gstreamer-properties

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

oss4sink

For the input:

oss4src

Note: It is 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 >

Note: For some applications (e.g. Rhythmbox, Totem) the gstreamer-properties have no effect, as they rely on "musicaudiosink" instead of "audiosink" (which is modified by gstreamer-properties). Workaround: Set audiosink with gstreamer-properties and use gconf-editor to copy the value of "/system/gstreamer/0.10/default/audiosink" to "musicaudiosink" (at the same location)

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 ~/.bashrc to be loaded on login.

Mplayer

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 do not want to bother typing it over and over again add "ao=oss" to your config file. ("$HOME"/.mplayer/config)

Music Player Daemon

MPD is configured through /etc/mpd.conf or ~/.mpdconf. Check both of these files, looking for something that looks like:

audio_output {
type "alsa"
name "Some Device Name"
}

If you find an uncommented (the lines do not begin with #'s) ALSA configuration like the one above, comment all of it out, or delete it, and add the following:

audio_output {
type "oss"
name "My OSS Device"
}

Note: I had to put this configuration in my ~/.mpdconf for it to work properly, but it ought to work in /etc/mpd.conf as well.

Further configuration might not be necessary for all users. However, if you experience issues (in that MPD does not work properly after it has been restarted), or if you like having specific (i.e. more user-configured, less auto-configured) config files, the audio output for OSS can be more specifically configured as follows: First, run:

ossinfo | grep /dev/dsp

Look for the line that says something similar to /dev/dsp -> /dev/oss/<SOME_CARD_IDENTIFIER>/pcm0. Take note of what your <SOME_CARD_IDENTIFIER> is, and add bolded lines to your OSS audio output in your mpd config file:

Audacity

If audacity will start but either complains that it cannot open the device or simply doesn't play anything, then you may be using vmix. Audacity expects exclusive access to your sound device. To fix this, before running audacity, run:

Other applications

Troubleshooting

Troubleshooting HDAudio devices

Understanding why problems arise

If you have a HDAudio sound device, it is 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 does not 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 "Volume Control" section.

You will probably want to setup a program to record/play continously in the background (e.g. ossrecord - | ossplay - for recording or osstest -lV 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 /usr/lib/oss/conf/oss_hdaudio.conf 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 /etc/rc.d/oss restart

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.

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, do not bother changing anything here as you will not 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.

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:

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 does not 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:

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.

As root, run "/usr/lib/oss/scripts/killprocs.sh". 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).

After all programs occupying vmix are terminated, run as root: "vmixctl rate /dev/dsp 96000" replacing the rate with your desired sample rate.

Run "ossmix | grep rate" and check for "vmix0-rate <decimal value> (currently 96000) (Read-only)" to see if you were successful.

Make changes permanent use the soundon.user file to set the rate for every soundon

write "vmixctl rate /dev/dsp 96000" in the file /usr/lib/oss/soundon.user and make it executable.

Changing the Default Sound Output

When running osstest, the first test passes for the first channel, but not for the stereo or right channel, it sounds distorted/hisses. If this is what your sound is like, then it is set to the wrong output.

Note: If you are using Opera you must kill operapluginwrapper before suspend. To do this add pid=$(pidof operapluginwrapper) && kill $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 does not work with all applications. It does not 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.