
Advanced Linux Sound Architecture (ALSA) is a
software framework
In computer programming, a software framework is a software abstraction that provides generic functionality which developers can extend with custom code to create applications. It establishes a standard foundation for building and deploying soft ...
and part of the
Linux kernel
The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
that provides an
application programming interface
An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) for
sound card device driver
In the context of an operating system, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabli ...
s.
Some of the goals of the ALSA project at its inception were automatic configuration of sound-card hardware and graceful handling of multiple sound devices in a system. ALSA is released under
GPL-2.0-or-later and
LGPL-2.1-or-later.
On Linux,
sound servers, like
sndio,
PulseAudio,
JACK (low-latency professional-grade audio editing and mixing) and
PipeWire, and higher-level APIs (e.g
OpenAL,
SDL audio, etc.) work on top of ALSA and its sound card device drivers. ALSA succeeded the older Linux port of the
Open Sound System
The Open Sound System (OSS) is an interface for making and capturing sound in Unix and Unix-like operating systems. It is based on standard Unix devices system calls (i.e. POSIX read, write, ioctl, etc.). The term also sometimes refers to ...
(OSS).
History
The project to develop ALSA was led by Jaroslav Kysela, and was based on the Linux device driver for the
Gravis Ultrasound sound card. It started in 1998 and was developed separately from the Linux kernel until it was introduced in the 2.5 development series in 2002 (2.5.4–2.5.5).
In the 2.6 version, it replaced the previous system,
Open Sound System
The Open Sound System (OSS) is an interface for making and capturing sound in Unix and Unix-like operating systems. It is based on standard Unix devices system calls (i.e. POSIX read, write, ioctl, etc.). The term also sometimes refers to ...
(OSS), by default (although a backwards-compatibility layer does exist).
ALSA has a larger and more complex API than OSS, so it can be more difficult to develop an application that uses ALSA as its sound technology. While ALSA may be configured to provide an OSS emulation layer, such functionality is no longer available or is not installed by default in many Linux distributions.
Features
ALSA was designed with some features which were not, at the time of its conception, supported by OSS:
* Hardware-based
MIDI
Musical Instrument Digital Interface (; MIDI) is an American-Japanese technical standard that describes a communication protocol, digital interface, and electrical connectors that connect a wide variety of electronic musical instruments, ...
synthesis.
*
Hardware mixing of multiple channels.
*
Full-duplex operation.
* Multiprocessor-friendly,
thread-safe device drivers.
Besides the sound device drivers, ALSA bundles a
user-space library
A library is a collection of Book, books, and possibly other Document, materials and Media (communication), media, that is accessible for use by its members and members of allied institutions. Libraries provide physical (hard copies) or electron ...
for application developers who want to use driver features through an interface that is
higher-level than the interface provided for direct interaction with the kernel drivers. Unlike the kernel API, which tries to reflect the capabilities of the hardware directly, ALSA's user-space library presents an abstraction that remains as standardized as possible across disparate underlying hardware elements. This goal is achieved in part by using
software plug-ins; for example, many modern sound cards or built-in sound chips do not have a "master volume" control. Instead, for these devices, the user space library provides a software volume control using the "
softvol" plug-in, and ordinary application software need not care whether such a control is implemented by underlying hardware or software emulation of such underlying hardware.
Applications
Additional to the software framework internal to the Linux kernel, the ALSA project also provides the command-line tools and utilities
alsactl
,
amixer
,
arecord/aplay
and
alsamixer
,
an
ncurses-based
TUI.
There also are GUIs programmed by
third-party developers, such as GNOME-ALSAmixer
(using
GTK
GTK (formerly GIMP ToolKit and GTK+) is a free software cross-platform widget toolkit for creating graphical user interfaces (GUIs). It is licensed under the terms of the GNU Lesser General Public License, allowing both Free software, free and ...
), Kmix,
XFCE4-mixer, LXpanel, QasHctl, QasMixer, Pavucontrol, AconnectGUI,
tapiir,
polarbear,
ALSAmixerGUI (using
FLTK),
ZynAddSubFX,
Yoshimi, and even more.
Concepts
Typically, ALSA supports up to eight ''cards'', numbered 0 through 7; each card is a physical or logical kernel device capable of input and output. Furthermore, each card may also be addressed by its ''id'', which is an explanatory string such as "''Headset''" or "''
ICH9''".
A card has ''devices'', numbered starting at 0; a device may be of ''playback'' type, meaning it outputs sound from the computer, or some other type such as ''capture'', ''control'', ''timer'', or ''
sequencer''; device number 0 is used by default when no particular device is specified.
A device may have ''subdevices'', numbered starting at 0; a subdevice represents some relevant sound endpoint for the device, such as a speaker pair. If the subdevice is not specified, or if subdevice number −1 is specified, then any available subdevice is used.
A card's ''interface'' is a description of an ALSA protocol for accessing the card; possible interfaces include: ''hw'', ''plughw'', ''default'', and ''plug:dmix''. The ''hw'' interface provides direct access to the kernel device, but no software mixing or stream adaptation support. The ''plughw'' and ''default'' enable sound output where the ''hw'' interface would produce an error.
An application typically describes sound output by combining all of the aforementioned specifications together in a ''device string'', which has one of the following forms (which are
case-sensitive):
* ''interface:card,device,subdevice''
* ''interface:CARD=1,DEV=3,SUBDEV=2''.
An ALSA ''stream'' is a data flow representing sound; the most common stream format is
PCM that must be produced in such a way as to match the characteristics or parameters of the hardware, including:
* ''sampling rate'': often 44.1 kHz on home stereos, or 48 kHz on home theaters, yet up to 88.2 kHz, 96 kHz, or even 192 kHz for hi-fi audio production or reproduction.
* ''sample width'': measured in some number of bits per sample (such as 8, 16, 24, or 32 bits/sample)
* ''sample encoding'': such as
endianness
file:Gullivers_travels.jpg, ''Gulliver's Travels'' by Jonathan Swift, the novel from which the term was coined
In computing, endianness is the order in which bytes within a word (data type), word of digital data are transmitted over a data comm ...
* ''number of channels'': 1 for mono, 2 for stereo, or 6 for
AC-3/
IEC958
Implementations
The ALSA System on Chip (ASoC) layer aims to provide better support for ALSA on
embedded system
An embedded system is a specialized computer system—a combination of a computer processor, computer memory, and input/output peripheral devices—that has a dedicated function within a larger mechanical or electronic system. It is e ...
s that use a
system-on-chip (SoC) design.
Open Sound System
The Open Sound System (OSS) is an interface for making and capturing sound in Unix and Unix-like operating systems. It is based on standard Unix devices system calls (i.e. POSIX read, write, ioctl, etc.). The term also sometimes refers to ...
version 4 is able to emulate ALSA.
QNX uses a sound system derived from, but not directly compatible with ALSA. The header file and library names are still "asound", same as the ALSA names. ALSA API uses calls in a way not allowed in the QNX kernel.
See also
*
Open Sound System
The Open Sound System (OSS) is an interface for making and capturing sound in Unix and Unix-like operating systems. It is based on standard Unix devices system calls (i.e. POSIX read, write, ioctl, etc.). The term also sometimes refers to ...
*
DSSI
*
udev
udev (userspace ) is a device manager for the Linux kernel. As the successor of devfsd and hotplug, udev primarily manages device nodes in the directory. At the same time, udev also handles all user space events raised when hardware devices ...
*
JACK Audio Connection Kit
*
KMid
*
LADSPA
*
PulseAudio
*
Alsamixer
*
PipeWire
References
External links
*
*
{{Linux kernel
1998 software
Application programming interfaces
Interfaces of the Linux kernel
Linux drivers