Difference between revisions of "Configuring Applications for OSSv4"

From Open Sound System
Jump to: navigation, search
m
m (Phonon)
Line 184: Line 184:
 
** GStreamer backend:
 
** GStreamer backend:
 
*** You need the oss or oss4 gstreamer plugin installed. See [[Configuring_Applications_for_OSSv4#Gstreamer.2C_required_for_Gnome_Volume_Applet|gstreamer]] entry.
 
*** You need the oss or oss4 gstreamer plugin installed. See [[Configuring_Applications_for_OSSv4#Gstreamer.2C_required_for_Gnome_Volume_Applet|gstreamer]] entry.
 +
** Outputting via PulseAudio works too, if the [[Configuring_Applications_for_OSSv4#PulseAudio|setup]] below for Pulse is followed.
  
 
=== Pulseaudio ===
 
=== Pulseaudio ===

Revision as of 07:17, 17 April 2010

Most applications should work with OSSv4 out of the box. However, sometimes distributions separate the OSS output plugins to another package, patch the software to use another sound API or neglect to compile OSS output support. This page will show how to tell some common applications to use the OSS API. There's no need to use any of these tips unless there's a problem. Headings prefixed with a distro name(s) are meant only for the named distro(s), though it may help other cases as well (e.g. most of the Debian advice is applicable to Ubuntu as well).

General issues

Getting system sounds

  • KDE 3.x: Open the "Control Center". Select "Sound & MultiMedia", "Sound System" and set up arts to use "Open Sound System".
    Alternatively, Open the "Contol Center". Select "Sound & MultiMedia", "System Notifications" and "Player Settings". Check "Use an external player", and select an OSS supporting player which support ogg files (ogg123 for example. In OSS 4.2 and above, ossplay supports Ogg/Vorbis files if libvorbis is installed in the system).
  • KDE 4.x: See instructions for Phonon below.
    Alternatively, you can set an external player program (Select "Notification" panel in system settings and then select "Player settings"). Same conditions as in KDE 3.x apply.
  • Gnome: This depends on version.
    • Older Gnome <= 2.22 outputs system sounds via esd, so install esound (e.g. apt-get install libesd0 esound on Ubuntu), and restart Gnome. Running esd under vmix is known to be buggy (esd is known to be buggy).
    • Newer Gnome >= 2.23 uses libcanberra. See: libcanberra
    • In Ubuntu 8.10, the desktop manager (gdm) uses an ALSA-only player (aplay) to play the startup/failed login sound. To fix this, edit /usr/lib/gdmplay and replace "aplay -N" with ossplay. For example:
 #!/bin/sh 
 /usr/bin/ossplay -q $@ 2> /dev/null
  • All the quoted names may be different on other systems due to localization.
  • XFCE : xfce4-mixer and applet are based on gstreamer. See above Gstreamer.

Midi applications

  • To merely play MIDI files, software synthesizers (like timidity and fluidsynth) will work fine (They can play MIDI files directory to OSS output.)
  • Other applications wishing to play MIDI which are not synthesizers themselves (like scummvm or tuxguitar) should be set to use (lib)fluidsynth or timidity.
  • You may decide to load ALSA's sequencer modules. As long as modules which touch the hardware or modules which emulate oss (snd-mixer-oss, snd-pcm-oss) are not loaded, this is safe. Than you could load timidity or fluidsynth as ALSA midi sequencers, and have the apps use these. This is not needed to make libfluidsynth or timidity's server mode work though.

libasound.so.2 errors

  • OSSv4.0 replaces libasound.so.2 with libsalsa, in order to allow some ALSA emulation. This may make some applications refuse to start with an "libasound.so.2: undefined symbol errors" error. (OSSv4.1 doesn't do this by default, and such errors probably have a different cause there). This can be fixed as follows:
    • Often, applications link to libasound.so.2 via a sound plugin. Thus, installing the respective OSS compatible plugin for the app may fix this (e.g. libesd0 instead of libesd-alsa0 on Debian/Ubuntu), as the application doesn't depend on libasound anymore.
    • If the method above doesn't help, you could just move libsalsa out of the way. It's rarely needed as the vast majority of apps can use OSS directly. This may require root permissions ("su" or "sudo").
      • mv /usr/lib/oss/lib/libsalsa.so.2.0.0 /usr/lib/oss/lib/libsalsa.so.2.0.0.bak
      • ldconfig
      • Note that installing OSSv4.0 will recreate libsalsa, so if you removed it you may wish to do this again. This only applies to the v4.0 versions.

ALSA Emulation

  • Another error which may happen is "ALSA lib pcm_hw.c:1240:(_snd_pcm_hw_open) Invalid value for card". This is emanating from the real libasound, and likely means that the program tried to use ALSA on a system with OSS installed. Unsurprisingly, the attempt failed.
  • Making the application use OSS (per instructions in this page) is always the best fix. However, there are ways to emulate ALSA if there's no other choice, see Tips_And_Tricks#ALSA_Emulation.

Multimedia Keys

General OSS problems

Specific applications

Gajim

  • Gajim use "aplay -q" by default. Go to preferences -> advanced -> open the configuration editor, and edit the key "soundplayer" : replace "aplay -q" by "ossplay -q".


cmus

  • Cmus' oss output plugin doesn't work with OSSv4, change to libao.
In cmus, type ":" to activate commandline, and "set output_plugin=ao"
Edit ~/libao or /etc/libao.conf to "default_driver=oss"
  • Optional: Enable cmus' software volume control:
Type ":" then "set softvol=true". Use + and - on the keyboard to change volume.

Ekiga

  • Debian: install libpt OSS plugin (e.g. libpt2.6.1-plugins-oss).
  • If Ekiga doesn't display the OSS device in the listing, you can add it manually using gconf-editor. The following keys should be changed:
apps/ekiga/devices/audio/input_device
apps/ekiga/devices/audio/output_device
apps/ekiga/general/sound_events
to a value of the form
'/dev/dsp (PTLIB/OSS)'
/dev/dsp can be replaced by other output nodes.
The following terminal commands can be used to set up Ekiga:
$ gconftool-2 --set /apps/ekiga/devices/audio/input_device --type string "/dev/dsp (PTLIB/OSS)"
$ gconftool-2 --set /apps/ekiga/devices/audio/output_device --type string "/dev/dsp (PTLIB/OSS)"
$ gconftool-2 --set /apps/ekiga/general/sound_events/output_device --type string "/dev/dsp (PTLIB/OSS)"

Enemy Territory - Quake Wars

  • ETQW: Edit ~/.etqwcl/base/etqwconfig.cfg and change
seta s_driver "alsa"
to
seta s_driver "oss"
  • Also, Command line parameter "+set s_driver oss" will make Quake engines use OSS driver, overriding setting in config files.

esd/esound

  • Debian: install libesd0 instead of libesd0-alsa.

Adobe Flash

  • Flash V7 uses OSS natively, so no special setup is needed.
  • Flash V9 and V10 require libflashsupport to output sound via OSS. Typically a 32-bit version of the library is required.
  • Flash V10 has a 64-bit version which requires a 64 bit libflashsupport.
  • OSSv4.1 tries to install a fitting libflashsupport automatically. However, some distros prefer removing libflashsupport from the package, using a separate package for it.

getting libflashsupport

  • Debian/Ubuntu:
    • Do not install libflashsupport package from apt-get. That packages only supports Pulseaudio, and should be removed if you have it.
    • You can Install flashplugin-nonfree-extrasound package and this should work, but that package misses some fixes for OSS [1].
  • Fedora: Versions 8/9 include a libflashsupport package which should be removed. That package only supports PulseAudio.
  • Gentoo: Add net-www/libflashsupport to /etc/portage/package.keywords file and emerge using: USE="oss ssl" emerge libflashsupport . Restart browser and now it should work. You can ignore the other instructions.
  • Arch: libflashsupport should be included in the oss package. If you installed OSS manually or the included libflashsupport fails, read on.
  • There is a precompiled 32-bit library for Linux/glibc [2], and a precompiled 64-bit library for Linux/glibc [3]. If you decide to use this version, download it and skip to "installing libflashsupport" below.
  • If none of the above applies/works for you, than the remaining option is to compile libflashsupport youself.
    • Compiling libflashsupport
      1. OSSv4 include the source code file, which is found at /usr/lib/oss/lib/flashsupport.c
        • 64 bit users will require gcc multilib support, unless they are compiling a 64bit library.
          • 64 bit Fedora users will not require "multilib" support but will need gcc-devel installed. Command would be, "yum install gcc-devel.i386" for Fedora 8 and above
          • In Debian/Ubuntu - sudo apt-get install gcc-multilib
      2. OSSv4.0: Comment out "#define OPENSSL" by placing a '//' in front of that line.
      3. To compile: cc -shared -fPIC -m32 -O2 -Wall flashsupport.c -o /tmp/libflashsupport.so
        • For a 64bit libflashsupport, omit "-m32" argument if you are running a 64bit OS.

installing libflashsupport

If you used a distro package to install libflashsupport, there's no need for the instruction below. Otherwise, follow this:
  1. sudo install -s libflashsupport.so /usr/lib/oss/lib
  2. sudo install -s libflashsupport.so /usr/lib
  3. sudo ldconfig
  4. Restart browser
  5. If that above failed, make sure that there aren't any other copies of libflashsupport in the system which happen to be picked up by ldconfig / Flash. 'ldconfig -p | grep libflashsupport' command may prove useful. If you're a 64-bit user and use a 32-bit Flash, make sure the copy of the 32bit libflashsupport is in your 32-bit library directory (/usr/lib32 on Debian or /usr/lib on Fedora)

Alternatives to Flash

  • If the above fails, than a Flash alternative can be used. These have the added advantage of these alternatives being free.
  • gnash works for many flash videos.
    • Debian: apt-get install apt-get install mozilla-plugin-gnash or apt-get install konqueror-plugin-gnash

fluidsynth

  • Use "-a oss" option.
  • fluidsynth may use a fragment size which is too low for the soundcard (256 bytes in one case), which leads to a background crackling when playing. use "-z 1024" (or an other value) to fix this.

gstreamer

  • Several programs and sound wrappers use gstreamer, e.g. Rhythmbox, Totem, Exaile, Banshee, etc.
  • Install gst-plugins-bad >= 0.10.7 or use a patched version of libgstoss4audio.so for gstreamer <= 0.10.6
    • Gentoo: emerge ebuild from unofficial overlay or from #232109.
    • For Debian >= 5.0/lenny and Ubuntu >= 8.10/Intrepid: apt-get install gstreamer0.10-plugins-bad
    • For Debian <= 4.0/etch or Ubuntu 8.04/Hardy, use precompiled patched gstreamer oss module (follow installation instructions in the included README file):
      • 32 bit libgstossaudio.so version available from [4]
      • 64 bit version available from [5]
  • Methods to configure gstreamer
    • Through the command line (In Debian/Ubuntu, install gconf2 package first). Here is a script [6] to make it fast/easy.
    • Install/run gconf-editor: We are interested in the /desktop/gnome/sound and /system/gstreamer/0.10/audio/default paths. In /desktop/gnome/sound/, you can toggle event sounds and select the sound theme.
    • In GNOME, the System -> Preferences -> Sound menu can be used, or these commands from the terminal: gnome-sound properties, gstreamer-properties
      • Ubuntu 9.10 uses a customized sound preferences dialog that requires Pulseaudio to run: [7] If you have a Launchpad account, please mark that bug as affecting you so it gets more developer attention. To work around the issue, you can use one of the other methods of configuring gstreamer or install the "old" gstreamer settings applet [8]. Move sound-properties.glade to /usr/share/gnome-control-center/glade/ (you may need to create this directory). Move the appropriate version of the gnome-sound-properties file to /usr/local/bin. You can run this program from the command line or create a shortcut for it.

herrie

  • Sound backend can only be selected before compilation, so you'll have to build in OSS support yourself. Fetch the source and do "./configure oss", followed by "make && make install".

JACK

  • jackd typically opens the device in O_EXCL mode. This means jackd gets exclusive ownership of the device, bypassing the virtual mixer (vmix). This can provide better performance, but bypassing vmix creates some effects:
    • jackd will fail to start if other programs are using the device, and other OSS-based sound programs will fail to start if jackd is using it (JACK aware programs will be able to output via jackd).
    • If the driver exposes only non-duplex (i.e. input-only or output-only) engines, jackd may fail to start (in these drivers, vmix will typically multiplex the engines, making programs able to transparently open /dev/dsp in O_RDWR mode. Since jackd bypasses vmix, it will probably only "see" the original output node). There are several ways to make jackd work:
      • Use jackd's '-C' switch to set proper input node. (e.g. "jackd -d oss -C /dev/oss/oss_hdaudio0/pcmin0").
      • Alternatively, you use '-i 0' switch to turn off input (e.g. "jackd -d oss -i 0").
  • (OSSv4.2 only) You can make OSS ignore jackd's request for exclusive ownership of the device by setting "excl_policy" in $OSSLIBDIR/conf/osscore.conf. This will make jackd use vmix, preventing both of the effects above.

libao, including libao based like mpg321

  • Add the following line to ~/.libao
    default_driver=oss

libcanberra

  • There are a few methods to get this working with OSS4:
    • Use libcanberra's gstreamer backend, and configure gstreamer appropriately (See: gstreamer instructions)
      • Debian testing/squeeze or later: install libcanberra-gstreamer package
      • Ubuntu 9.10: get libcanberra packages from the [9]
    • Use ALSA emulation. The libasound2-plugin method is known to work: Tips_And_Tricks#ALSA_Emulation
    • If you run Pulseaudio, libcanberra can output directly to it. (a libcanberra-pulse package is available for Debian testing/squeeze and Ubuntu 9.10). See Pulseaudio instructions.

libsnack based apps, like amsn

  • Debian: install libsnack2 instead of libsnack2-alsa.
    • Older amsn package on Debian/Ubuntu has faulty dependencies, which mention libsnack2-alsa only. Newer packages are fixed, but if upgrade is not possible, you may have to: install amsn first, edit /var/lib/dpkg/status to fix the deps (change libsnack2-alsa to "libsnack2-alsa | libsnack2"), and then install libsnack2.

mpd

  • Debian, Ubuntu: These distros install a /etc/mpd.conf, which overrides ~/.mpdconf contrary to Unix conventions... You need to edit /etc/mpd.conf and uncomment the audio_output of type "oss" section.

mpg123

  • Debian: install mpg123 instead of mpg123-alsa

MPlayer

  • write the following line to ~/.mplayer/config
    ao = oss

openal, including openal based like Quake4

  • Write the following line to ~/.openalrc
    (define devices '(native oss))
  • OpenAL Soft uses a different configuration method. Write the following to ~/.alsoftrc:
    [general]
    drivers = oss

Phonon

  • Phonon should automatically output via OSS. Configuration is different depending which backend is used:
    • Xine backend:
      • Old versions (KDE4.0.x) of the Xine backend didn't work with OSSv4. In that case use the gstreamer backend. In the newer versions, you should be able to prefer "OSS default output" in the KDE multimedia settings.
      • Phonon might mistakenly think the default output has been disconnected - erase ~/.kde/share/config/phonondevicesrc if the OSS option isn't available and recheck multimedia settings again.
    • GStreamer backend:
      • You need the oss or oss4 gstreamer plugin installed. See gstreamer entry.
    • Outputting via PulseAudio works too, if the setup below for Pulse is followed.

Pulseaudio

  • Edit /etc/pulse/default.pa and
    • Remove "module-hal-detect" (it won't detect OSS anyway).
    • Uncomment "module-oss" line and add "mmap=0" at end.
      • If "module-oss" line does not exist add the line below to default.pa:
      load-module module-oss device="/dev/dsp" sink_name=output source_name=input mmap=0
    • You may wish to copy this file to ~/.pulse directory, so that it isn't overwritten by a package upgrade.

quake3

  • Q3 outputs natively to OSS using mmap() interface. Some OS ports of OSSv4 don't support mmap(). You might be able to use [10] to make quake3 output sound via SDL library. SDL should of course be set up to use OSS.

recordmydesktop

  • This software supports either OSS or ALSA (set at compile time). Some distros set ALSA at compile time.
  • Debian:
    1. Get the source of the package (apt-get source recordmydesktop) and the build dependencies (apt-get build-dep recordmydesktop).
    2. Edit debian/rules to provide --enable-oss=yes to configure.
    3. Build package with dpkg-buildpackage and (re)install it.
    4. You may wish to prevent upgrades from overwriting the package with the ALSA version: echo recordmydesktop hold | dpkg --set-selections (as root).
  • Note that the used recording source should be set to 'vol' (if available) or 'loopback' should be activated (if available) in ossmix or ossxmix before starting recordmydesktop. If neither of these is possible, you can set recordmydesktop to use a vmix loopback device. See Tips And Tricks#Recording_sound_output_of_a_program.

scummvm

  • scummvm works fine, but midi output may need tuning.
  • scummvm 0.11.0 supports midi output via timidity and also via fluidsynth.
  • Start timidity -Od -ir 7777 and then run scummvm. Select "TiMidity" as a music driver.
  • Alternately, if fluidsynth is compiled, you can select it as music driver. You need to add a soundfont entry to ~/.scummvmrc .

SDL, including SDL-based like frozenbubble

  • Debian: install libsdl1.2debian-oss or libsdl1.2debian-all
  • set SDL_AUDIODRIVER=dsp in the environment

skype

  • From 1.4 onward, Skype supports OSS using a separate OSS-enabled binary. The regular binary will not work!
  • Arch: install skype-oss
  • Ubuntu Intrepid: apt-get install skype-static-oss (from the medibuntu/multiverse repository)
  • install static OSS version from skype [11] (Direct link to skype static OSS version 2.0.0.72: [12])

sox

  • Debian: install libsox-fmt-oss

wine

  • Debian: install libwine-oss.
  • Select OSS driver in winecfg - audio tab. (In some cases winecfg will output ALSA lib errors - they can be ignored).

vlc

  • Write the following line to ~/.vlc/vlcrc
    aout=oss
  • Alternately:
    From VLC click tools --> preferences --> Audio
    From the "type" menu, select "UNIX OSS audio output"

vmware

  • Autodetection doesn't work well with OSSv4. Edit the .vmx file and set
    sound.autodetect: False

xine

  • Write the following line to ~/.xine/config
    audio.driver:oss

xmms2

  • Install the OSS output plugin
    • Ubuntu Intrepid: apt-get install xmms2-plugin-oss
  • Modify the output plugin in the config file
    • Replace alsa with oss in the output plugin configuration entry inside the xmms config file (which should be ~/.config/xmms2/xmms2.conf)