Use oss4 for Ubuntu

Source: Internet
Author: User

First, we will introduce the background. The Linux audio system has a very short history:

  • 1. oss3 is an old voice system in the Linux kernel and has been gradually deprecated.
  • 2. oss4 was developed with closed source software. Therefore, in 2002, ALSA was used to replace oss3 as the voice architecture in the Linux kernel.
  • 3. In 2007, 4 front technologies released the GPL version of oss4, And now ALSA has become a climate

    Introduction to ALSA, oss4, pulseaudio, and Jack (10 thousand words are omitted for ESD ):

  • 1. ALSA is currently a standard Audio Framework on the Linux kernel. However, ALSA only supports Linux systems and does not support software reverb. Provides comprehensive support for various devices.
  • 2. oss4 failed to become part of the official kernel because it missed the opportunity, but its cross-platform performance is far better than ALSA. It supports windows, BSD, and many UNIX. Its API is also said to be more suitable for development. Oss4 features real-time and low-latency features and supports software reverb. All operations are implemented at the kernel layer. However, the support for USB devices is much weaker.
  • 3. pulseaudio is a sound proxy program designed for POSIX compatible environments, with built-in software reverb. Pulseaudio can proxy the program's requests to the sound system to multiple backends such as ALSA and OSS, and even transmit these messages over the network.
  • 4. Jack is a professional-level sound service system with strong cross-platform performance. Jack has higher real-time requirements on the kernel than pulseaudio. Jack is not popular in general operating systems.

    By default, UBUNTU uses ALSA as the underlying sound driver, and the program interacts with pulseaudio. This is a good solution. However, the author occasionally encounters the problem that ALSA is monopolized by other software and cannot speak out, just as the oss4 Craze on # Ubuntu-CN is catching up with fashion.

    For oss4, there is a risk of tossing. The following are the reasons for tossing:

  • 1. The default ALSA does not work properly on your computer
  • 2. I like oss4 and do not like ALSA.
  • 3. Want to follow suit

    Oss4 benefits:
    1. In some cases, the sound quality is better.
    2. Low latency and low CPU usage
    3. built-in software reverb
    4. More comprehensive documentation

    The specific disadvantages of oss4:
    1. Some hardware is not supported
    2. Poor Support for MIDI
    3. Support for USB sound equipment is still in experimental stage
    4. self-defeating system sound systems may be involved

    Start with how to install oss4.
    Method 1
    Download the free commercial version from the oss4 official website.
    Select a version, such as Linux 2.6 (x86) (DEB), and click Submit to obtain the download link. Note that this version can only be used for one year by license.
    After obtaining the Deb file, double-click the installation (or sudo dpkg-I OSS-Linux *. Deb ).
    Method 2
    Ubuntu 10.10 can directly install the old version oss4 from the software Repository:
    sudo apt-get install oss4-base oss4-dkms oss4-gtk
    Ubuntu 10.04 and 11.04 cannot use this method, the oss4-dkms in the 10.04 repository has packaging problems and cannot correctly build the kernel module, 11.04 because the kernel is new (Linux> = 2.6.36) the oss4 version is too old to successfully build the kernel module.
    Method 3
    If you like the open-source version as I do, and you like it, let's compile the latest version together.
    First install mercurial to retrieve the latest code:
    sudo apt-get install mercurial
    Retrieve the Code:
    cd ~
    hg clone http://opensound.hg.sourceforge.net:8000/hgroot/opensound/opensound oss-devel

    Create a compilation directory. oss4 needs to be compiled in an empty directory:
    cd ~/
    sudo rm -rf oss42build
    mkdir oss42build

    Compile and install. Assume that your main directory is/home/Aron:
    cd oss42build/
    NO_WARNING_CHECKS=yes /home/aron/oss-devel/configure --enable-libsalsa=NO
    make
    sudo make deb
    sudo dpkg -i oss*.deb

    The installation is complete. If no errors are encountered, configure the following:
    1. Even though oss4 has built-in software reverb, I still haven't deleted pulseaudio, because many components in the Ubuntu Desktop Environment only set the pulseaudio backend. I don't want to go around one by one, but try to make the program use oss4. After all, major players support custom audio output. If you want to do the same, do the following. If you don't want to, skip this section.

    A. Modify the pulseaudio settings so that it uses oss4 output by default:
    gksu gedit /etc/pulse/default.pa
    Add a row:

      Load-module-OSS device = "/dev/DSP" sink_name = output source_name = input MMAP = 0

    B. Configure gstreamer to use oss4 as the backend:
    Install gstreamer0.10-plugins-bad
    sudo apt-get install gstreamer0.10-plugins-bad
    Run the following command:
    gstreamer-properties
    Set both input and output to OSS.

    C. Set libasound to transfer the voice request sent to ALSA to oss4:
    gksu gedit /etc/asound.conf
    Add the following content:

      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
      }

    D. Enable oss4 by default instead of ALSA at startup:
    sudo dpkg-reconfigure linux-sound-base
    Select OSS instead of ALSA or default.

    Then restart the computer and complete system-level configuration. Then, you can configure oss4 for software that supports custom audio systems, such as audacious, wine, audacity, VLC, (s) mplayer, and Clementine.

    2. If you want to delete pulseaudio, there is also a solution, but it is not guaranteed that all programs can output the sound correctly. First, adjust the settings according to B, C, and D in the previous configuration method, and then enable pulseaudio according to E and F.

    E. Use gstreamer to take over the gnome sound system and install libcanberra compiled for the gstreamer backend:
    sudo add-apt-repository ppa:dtl131/ppa
    sudo apt-get update
    sudo apt-get purge pulseaudio
    sudo apt-get upgrade

    F. Configure rhythmbox and other programs to use gstreamer (yes, you still need to configure it)
    Run:
    gconf-editor
    Locate system/gstreamer/0.10/Audio/default and change all keys (such as musicaudiosink and chataudiosink) that are still set as pulsesink to osssink.
    The default volume control plug-in is invalid because it is based on pulseaudio and can be right-clicked on the panel to add a gnome sound control.

    Then restart the system. Most sound systems are normal.Possible problems:
    1. Flash. You must install flashplugin-nonfree-extrasound to obtain libflashsupport that supports oss4.
    2. Firefox and xulrunner cannot be compiled to support both ALSA and oss4, so there may be problems.

    FAQ

    1. Sound Input is unavailable or there is noise
    Run the following command:
    ossxmix
    Select input from the pink drop-down menu on the displayed interface, select all input-mix and input-Mix-mute on the interface, and drag the slider at pink to reduce the volume, generally, it is recommended to increase or lower by 80%, otherwise there will be noise.

    2. How do I check whether the oss4 kernel module has been loaded and what modules are used for my sound card?
    Run the following command:
    lsmod | grep -i oss
    For example, if I am HD Audio, the output is as follows:

      Oss_usb 104136 1
      Oss_hdaudio 144219 3
      Osscore 545146 2 oss_usb, oss_hdaudio

    3. How can I check my sound card model?
    lspci | grep -i audio

    4. Can 64-bit systems be used?
    Yes, no problem.

    5. Can kde4 use phonon?
    Phonon should be able to detect oss4 directly by default. KDE 4.0.x may not be available when xine is used at the backend.

    6. What is used to adjust the volume?
    If pulseauido is retained, the program that uses it can use the original volume control. If gstreamer is used, the volume control program of gnome can be used.
    Of course, you can also use the ossxmix tool or tools such as xfce-OSS and kmix.

    I don't want to use oss4 anymore. How can I restore it?
    I will explain the required operations for the above a B c d E F respectively.

    A. Restore pulseaudio's default Hardware Detection
    gksu gedit /etc/pulse/default.pa
    Delete the added row.

    B. Configure gstreamer to use pulseaudio as the backend
    Run the following command:
    gstreamer-properties
    Set both input and output to pulseauido.
    If you do not want gstreamer0.10-plugins-bad, you can delete it:
    sudo apt-get purge gstreamer0.10-plugins-bad

    C. Set libasound to use ALSA:
    Delete all rows added to/etc/asound. conf. If you have not modified oss4 before, just delete it:
    sudo rm /etc/asound.conf

    D. Enable ALSA by default during startup:
    sudo dpkg-reconfigure linux-sound-base
    Select ALSA.

    E. switch back to the libcanberra backend that supports gstreamer and pulseaudio:
    Install required software:
    sudo apt-get install pulseaudio indicator-sound libcanberra-pulse libcanberra-gstreamer pulseaudio-esound-compat pulseaudio-module-bluetooth pulseaudio-module-gconf pulseaudio-module-x11 ppa-purge
    Delete the added PPA:
    sudo ppa-purge ppa:dtl131/ppa
    sudo apt-get update

    If not, downgrade all related software packages manually (which is disgusting, but there is no other way ), you can use the local or obsolete filter in the new version to determine which packages are used.

    F. Configure programs such as rhythmbox to use pulseaudio
    Run:
    gconf-editor
    Find system/gstreamer/0.10/Audio/default, and change all keys that are still set as osssink to pulsesink.

    Then, replace all previously modified programs that use oss4 with pulseaudio and restart the system.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.