Linux Audio Architecture

If ALSA and OSS have no secrets for you, you might try your hand on Jack or Pulseaudio.

 

ALSA

The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI functionality to the Linux operating system. ALSA has the following significant features:

  • Efficient support for all types of audio interfaces, from consumer sound cards to professional multi channel audio interfaces.
  • Fully modularized sound drivers.
  • SMP and thread-safe design.
  • User space library (alsa-lib) to simplify application programming and provide higher level functionality.
  • Support for the older Open Sound System (OSS) API, providing binary compatibility for most OSS programs.

Source: ALSA

 

Upgrading to the latest version can be done using a script by Soundchekk

OSS

 

Open Sound System (OSS) is the first attempt in unifying the digital audio architecture for UNIX. OSS is a set of device drivers that provide a uniform API across all the major UNIX architectures. It supports Sound Blaster or Windows Sound System compatible sound cards which can be plugged into any UNIX workstation supporting the ISA or PCI bus architecture. OSS also supports workstations with on-board digital audio hardware.

Source: 4Front Technologies

OSS is developed by Hannu Savolainen.

Unable to make a living out of it, he is forced to reduce his efforts.
Check his blog for more details.

 

JACK

JACK is system for handling real-time, low latency audio (and MIDI). It runs on GNU/Linux, Solaris, FreeBSD, OS X and Windows (and can be ported to other POSIX-conformant platforms). It can connect a number of different applications to an audio device, as well as allowing them to share audio between themselves. Its clients can run in their own processes (ie. as normal applications), or can they can run within the JACK server (ie. as a "plugin"). JACK also has support for distributing audio processing across a network, both fast & reliable LANs as well as slower, less reliable WANs.

Source: JACK

Pulseaudio

PulseAudio is a sound server for POSIX and Win32 systems. A sound server is basically a proxy for your sound applications. It allows you to do advanced operations on your sound data as it passes between your application and your hardware. Things like transferring the audio to a different machine, changing the sample format or channel count and mixing several sounds into one are easily achieved using a sound server.

Source: Pulseaudio

More about Pulseaudio can be found here

 

Bit perfect output

ALSA and PulseAudio have a symbiotic relationship in Ubuntu.

ALSA is configured to send audio to PulseAudio as a virtual device, PulseAudio then resamples and converts everything to (by default) 16/44.1 and sends it out to an ALSA device.
By default, ALSA dmix is configured to operate at 48kHz.
So, in the worst possible case, if dmix is enabled (and there are quite a few tutorials on the net suggesting that this be done) ...

app -> ALSA -> dmix (resample to 16/48) -> PulseAudio (resample to 16/44.1) -> ALSA sound driver -> audio device

Or, if JACK is used and configured to 192kHz (again, some naive tutorials recommending this)
app -> JACK (resample to 24/192) -> PulseAudio (resample to 16/44.1) -> ALSA sound driver -> audio device

and in the best possible scenario
app (via gstreamer or JACK etc.) -> PulseAudio (resample to 16/44.1) -> ALSA sound driver -> audio device

Sheesh! Whoever said Linux had a great architecture for audio?

Christine Tham