OSS

From ArchWiki

Jump to: navigation, search
i18n
English
简体中文

Contents

[edit] Introduction

The Open Sound System (OSS) from www.opensound.com is a commercially-supported sound driver that works on several unix-like systems, including Linux, FreeBSD, and Solaris.

The OSS was previously proprietary and being open-sourced recently, it has nothing to do with the sub-quality OSS/free in early linux kernels.

Pros:

  • Transparent software mixing in kernel space (virtual mixer), up to 18 virtual sound devices (unlike ALSA's dmix, which works in user-space via ALSA lib).
  • Per-application mixer volume.
  • Much better sound quality for several onboard audio chips.

Cons:

  • Software-emulated 3D enhancement, reverb effect, and equalizer have not yet been added to the new mixing engine in oss v4.

[edit] Installation

NOTE: Perform this command as a normal user. Do not run it as root or with sudo.

  • Start oss-linux:
    • Add !soundcore to MODULES in /etc/rc.conf to blacklist it.
    • Reboot to clean up alsa drivers, or manually unload the module soundcore and all other modules depending on it.
    • Run /etc/rc.d/oss-linux-free start (or oss-linux in case of the older, proprietary package), or add it to DAEMONS in /etc/rc.conf

[edit] Configuration

Your sound card should not need any configuration to work properly

Config files used to load oss drivers are under /usr/lib/oss/conf. Do not edit these files directly, instead you should use /etc/modprobe.conf. Every file under /usr/lib/oss/conf is named MODULE_NAME.conf and all the options are passed to modprobe when you're starting oss-linux. So the following two methods are actually doing the same thing:

(/usr/lib/oss/conf/osscore.conf)

   max_intrate=1000
   src_quality=4

(/etc/modprobe.conf)

   options osscore max_intrate=1000 src_quality=4

NOTE: This is merely an example, it is not recommended to use these parameters unless you know what you're doing.

To get the list of the drivers you use, run ossdetect -v and check the file /usr/lib/oss/etc/installed_drivers.

Other parameters: see the comments in

   /usr/lib/oss/conf/osscore.conf
   /usr/lib/oss/conf/ossusb.conf
   /usr/lib/oss/conf/YOUR_AUDIO_DRIVER.conf

[edit] Programs

  • /etc/rc.d/oss-linux: oss-linux service.
  • /etc/rc.d/oss-linux-free: same as above, but for the free version.
  • ossinfo: show list of sound devices and their status; passing argument "-v9" to get details including which programs use them.
  • ossmix: command-line mixer, where you can configure volume, recording source and special sound effects (surround, reverb, etc).
  • ossxmix: same as ossmix except for that it provides a GUI using gtk2.
  • savemixer: save your current mixer settings (need superuser) or restore them, called automatically when the oss-linux service is stopped.
  • ossrecord: simple command-line recording program.
  • ossplay: simple command-line playing program. Supports WAV, AU, VOC and a few other containers.

[edit] Troubleshooting

  • Like ALSA, you have to lower the main volume and PCM volume to certain degree to avoid noises (depending on your audio chip. I use vol=65,pcm=65 for my via8237)
  • See here how to set the default soundcard, in case the default choice isn't optimal.
  • If you have a problem getting sound from an application, the 4front wiki may have the answer.

[edit] Skype

There's a special Skype version for OSS (QT static build), you can get the PKGBUILD here [1]. A binary is available from skype's download page [2].

[edit] Tips and Tricks

[edit] ALSA compatibility

OSS provides 2 layers for ALSA compatibility: kernel and alsa lib. The kernel module ("cuckoo") was 100% compatible with all the apps but it no longer works with latest OSS version; The alsa emulation lib in oss distribution is outdated and I don't know where to get the latest version.

What you can have now is to use ALSA's oss plugin:

  1. Install alsa-plugins
  2. Edit /etc/asound.conf:
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
}

This method doesn't work with stupid programs that detect hardware sound devices (skype 1.3, gizmo, ..)

[edit] Using your multimedia keys with OSS

Wanting to raise-lower-mute-unmute the sound with your multimedia keys using OSS v4?

Just make three "scripts" like these (I am assuming you have the bc package installed):

lowervolume.sh:

 VOL=$(ossmix | grep misc.pcm1 | awk '{print $4}' | awk -F : '{print $1}')
 VOL=$(echo $VOL-2 | bc)
 ossmix misc.pcm1 $VOL:$VOL

raisevolume.sh:

 VOL=$(ossmix | grep misc.pcm1 | awk '{print $4}' | awk -F : '{print $1}')
 VOL=$(echo $VOL+2 | bc)
 ossmix misc.pcm1 $VOL:$VOL

mute.sh:

 #!/bin/bash
 VOLUME=$(cat $HOME/.volume)
 if [ -z "$VOLUME" ]; then
       VOLUME=$(ossmix | grep misc.pcm1 | awk '{print $4}' | awk -F : '{print $1}')
       ossmix misc.pcm1 0:0
       echo $VOLUME > $HOME/.volume
 else
       ossmix misc.pcm1 $VOLUME:$VOLUME
       > $HOME/.volume
 fi

This will restore the previous volume levels when unmuting. Issue a:

 touch $HOME/.volume

before using the first time.

Then you just have to chmod +x these and set the keyboard shortcuts on your VM.

[edit] System-wide (software) equalizer effects

NOTES: This requires the use of the old softoss module (the predecessor of vmix) which may not be as good as vmix, wine and gstreamer do not play nice with softoss, and the effects will not work with sample rates higher than 48khz.

We must do a few things to gain access to these effects.

  • If you're running the oss-linux-free daemon right now, stop it by running (as root):
/etc/rc.d/oss-linux-free stop
  • in /usr/lib/oss/etc/installed_drivers replace
vmix

with

softoss
  • in /etc/rc.d/oss-linux-free comment out lines 15 through 20 so that it looks kinda like this
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
case "$1" in
 start)
   stat_busy "Starting OSS/Open source driver"
   # start
   /usr/sbin/soundon
   if [ $? -gt 0 ]; then
     stat_fail
   else
     grep '^softoss' /proc/modules >/dev/null 2>/dev/null
#      if [ $? -eq 0 ]; then
#        stat_busy "Replacing old \"softoss\" module with \"vmix\""
#        rmmod softoss
#        modprobe vmix
#        sed -i 's/^softoss.*$/vmix/' /usr/lib/oss/etc/installed_drivers
#      fi
     add_daemon oss4
     stat_done
   fi
   ;;
 stop)
   stat_busy "Saving OSS mixer"
   /usr/sbin/savemixer
   if [ $? -gt 0 ]; then
     stat_fail
   else
     stat_done
   fi
   grep '^"cuckoo"' /proc/modules >/dev/null 2>/dev/null
   if [ $? -eq 0 ]; then
     stat_busy "Removing \"cuckoo\" module"
     rmmod \"cuckoo\"
   fi
   stat_busy "Stopping OSS/Open source driver"
   /usr/sbin/soundoff
   if [ $? -gt 0 ]; then
     stat_fail
   else
     rm_daemon oss4
     stat_done
   fi
   ;;
 restart)
   $0 stop
   sleep 1
   $0 start
   ;;
 *)
   echo "usage: $0 {start|stop|restart}"
esac

This keeps the oss-linux-free daemon from replacing softoss with vmix. (Very useful if you wish to switch between softoss and vmix.)

  • start the daemon again (as root of course)
/etc/rc.d/oss-linux-free start
  • If no errors are reported, then you may now see/use the effects with either ossmix or ossxmix with
ossmix -d1

or

ossxmix -d1
  • you must turn off bipass to actually use the effects
ossmix -d1 effects.eq.bypass OFF

or just uncheck bypass in ossxmix

  • enjoy
Personal tools