How to switch from alsa to OSSv4

I’ve recently switched from alsa to OSSv4 on my linux box and I find the difference in quality amazing. I can now hear details in the music I did not hear before on my laptop. And as a nice side effect it solved a problem I’ve had with flash for a long time. After using firefox for several hours, sound in flash started to stutter and the only way to solve that was to restart firefox.

First of all, I’m using ubuntu 9.04 (Jaunty Jackalope) 32-bits with kernel 2.6.28-13-generic. I have a built in HD audio (ICH6 family). I never had any problems with alsa or pulse, though I removed pulse not long after installing, since I did not see the benefit of it.

benefits, drawbacks and popular misconceptions

beneftis

  • Better sound quality.
  • Mixing is done within kernel space, meaning lower latency
  • drawbacks

  • Your card may not be supported
  • midi is not supported yet.
  • sound recording on generic usb sound devices is not yet implemented, and support for those devices is still considered experimental.
  • popular misconceptions

  • Some people seem to believe OSS is a security risk, since it does mixing within kernel space. However, I’ve seen none of them explain why this would be so.
  • How to install OSSv4

    Before you begin.

    Install libasound2-plugins. Just open a terminal and type:
    sudo apt-get install libasound2-plugins
    Make sure your soundcard is supported.
    Here’s the list of currently supported cards.
    If you ever created a custom config file for alsa back it up and remove it. Since I know what kind of hell it is, to write one of those I would not want you to loose the work it took to create one. If you don’t know what I mean, just type.
    ls ~/.asoundrc
    ls /etc/asound.conf
    If both commands show nothing, consider yourself lucky you never had to create a custom configuration for alsa.
    Otherwise use sudo mv to move them to a back-up position.

    installation

    Go to the 4-front-tech website.. Click on download in the menu on the left. clik on the opensound logo (the big one on the left), choose Linux 2.6 (x86) (DEB), since this is a guide for ubuntu. If you have a 64 bit version of linux installed, choose the amd64 version instead. Now press submit and you will be provided with two download links. A installer deb and a pdf with instructions. Download them both.

    Reboot, press esc to enter the grub menu and choose the second option, start in recovery mode. Next choose a root prompt, either with or without network access. Use cd to go to the location where you downloaded OSS to and use dpkg -i to install it.
    I created a directory snd in my home directory and my username is tin. So here’s how it looked on my pc.

    cd /home/tin/snd
    dpkg -i oss-linux*

    Reboot and OSS is up and running.

    Troubleshooting

    general

    First to see if everything is working, open a terminal and type:
    lsmod | grep oss
    in my case, it shows:

    oss_usb 117132 3
    oss_hdaudio 143076 7
    osscore 561844 4 oss_usb,oss_hdaudio

    This means I have hd audio sound card and one or more usb-ports, where I could attach a usb sound device to. If you only see the usb_audio device and not your internal card, just reboot and uninstall. If you’ve experienced the superior sound quality on a different machine and you’re disappointed that your hardware is not supported. Please go to the oss forum for help.

    Both the arch and the opensound wiki show how to create the following configuration in /etc/asound.conf or ~/.asoundrc

    pcm.!default {
    type oss
    device /dev/dsp
    }
    ctl.!default {
    type oss
    device /dev/mixer
    }

    I would strongly advice against doing so. Most applications support both the oss and the alsa api. Since the kernel developers switched from alsa to oss, when oss became closed source in the past, alsa became the standard for most applications. This would mean your applications will use the alsa api to output to oss, instead of using oss directly. I also had the problem, that I was no longer able to play anything on 44.1 kHz, since my sound card is set to use 48kHz.

    gstreamer (and system sounds)

    Gstreamer is the backend used by totem 1 (aka movieplayer), banshee and songbird. It is also used in the gnome-desktop to play system sounds.
    Normally this is set correctly by the installer. Unless you’ve done changed the setting manually you would not need to change this.
    To set the sound output correctly, open gstreamer-properties from a terminal.
    Choose custom for both input and output, then osssink as output and osssource for input. (notice the 3 esses in both cases)
    gstreamer-properties

    flash

    If you have no sound in flash, check that there’s only one file called libflashsupport.so on your system and it links to the proper file.

    ls /usr/lib/libflashsupport.so -al
    lrwxrwxrwx 1 root root 38 2009-07-22 00:05 /usr/lib/libflashsupport.so -> /usr/lib/oss/lib/libflashsupport_32.so
    sudo updatedb
    locate libflashsupport.so
    /usr/lib/libflashsupport.so

    If you have more than one occurrence of libflashsupport.so remove them. If the files is not there or not linked correctly, this is how you can create a new symbolic link:
    sudo ln -s /usr/lib/oss/lib/libflashsupport_32.so /usr/lib/libflashsupport.so

    jack audio connection kit

    The only not working after installing oss, was jack.
    When I did a sudo jackd -h, it did not show oss as a sound-option, though it showed jack_oss.so in /usr/lib/jack/
    sudo ldconfig
    solved that.

    pulse audio

    Though pulse is rather unnecessary when using oss, this is how to activate it, according to the oss wiki.
    For pulse audio to work, you need to make a few adjustments.
    Open a terminal and enter:
    sudo gedit2 /etc/pulse/default.pa
    put a # in front of module-hal-detect
    uncomment the line with module-oss and add mmap=0 to it.
    if the line does not exist, add the following line to the end of the file.
    load-module module-oss device=”/dev/dsp” sink_name=output source_name=input mmap=0
    You should of course make a comment (a line starting with #) to document your changes. šŸ˜‰

    uninstall

    Reboot and go to a terminal, like described in the installing procedure, and type:
    sudo apt-get purge oss-linux
    Also revert other changes you have made in the settings. If you haven’t changed anything, your system should be back in the state it was before.

    Some notes

    resources

    The opensound wiki
    the arch wiki
    sound in linux not so sorry after all
    Please note that both wiki’s provide more information about settings for different applications. I only provided the ones I considered standard.

    footnotes

    1. There is of course also a totem version with xine as a backend.
    2. If you don’t use gnome, replace gedit by kate for kde, mousepad for xfce, leafpad for lxde or nano if you prefer to edit within the terminal.

    version history

    1.0 created 25/7/2009

    disclaimer

    If you find anything incorrect in this tutorial, please notify me. You can do so by commenting in the thread. If this was helpful to you and you like OSS, it would be nice to let me know, by placing a comment. šŸ™‚ This is not a support forum. If you would like some help and you use ubuntu, create a thread in the ubuntu forums, and post a link here. Any additional information, like special settings for specific hardware would also be appreciated. If you’re missing something, you are also very welcome to write a request.

    It may take some time, before I approve your comment. If you want to start a discussion wetter oss is better/worse than alsa, do it elsewhere and just post a link here. If I think your comment is inappropriate I’ll delete it after reading. This doesn’t mean you are not to allowed to post negative experiences if you’ve had them. Just don’t use inappropriate language. If it’s your hobby to insult people, just go yell at your friends and tell them what kind of morons they are, for an even better experience I’d advice total strangers in a public place, preferable ones a bit bigger than you and looking not too bright. Here however is not the place to do so.

    Advertisements

    Tags: , , , , , , ,

    2 Responses to “How to switch from alsa to OSSv4”

    1. VonipessZoorp Says:

      Oh my god enjoyed reading your blogpost. I added your feed to my blogreader.

    2. How to switch from ALSA to OSS! « Xeizo Says:

      […] https://martinbaselier.wordpress.com/2009/07/25/how-to-switch-from-alsa-to-ossv4/ […]

    Leave a Reply

    Fill in your details below or click an icon to log in:

    WordPress.com Logo

    You are commenting using your WordPress.com account. Log Out / Change )

    Twitter picture

    You are commenting using your Twitter account. Log Out / Change )

    Facebook photo

    You are commenting using your Facebook account. Log Out / Change )

    Google+ photo

    You are commenting using your Google+ account. Log Out / Change )

    Connecting to %s


    %d bloggers like this: