Software:Advanced Linux Sound Architecture
Screenshot of Alsamixer 1.0.14 | |
Original author(s) | Jaroslav Kysela[1] |
---|---|
Developer(s) | ALSA team[2] |
Initial release | 1998 |
Written in | C[3] |
Operating system | Linux |
Type | |
License | |
Website | alsa-project |
Advanced Linux Sound Architecture (ALSA) is a software framework and part of the Linux kernel that provides an application programming interface (API) for sound card device drivers.
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.[4]
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 (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).[5]
In the 2.6 version, it replaced the previous system, Open Sound System (OSS), by default (although a backwards-compatibility layer does exist).[6]
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 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 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[7][8][9] and utilities[10] alsactl
,[11] amixer
,[12] arecord/aplay
and alsamixer
,[12] an ncurses-based TUI.
There also are GUIs programmed by third-party developers, such as GNOME-ALSAmixer[13] (using GTK), Kmix,[13] XFCE4-mixer, LXpanel, QasHctl, QasMixer, Pavucontrol, AconnectGUI,[14] tapiir,[14] polarbear,[14] ALSAmixerGUI[15] (using FLTK), ZynAddSubFX, Yoshimi, and even more.
Concepts
This section provides an overview of basic concepts pertaining to ALSA.[16][17][18]
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;[19] 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[citation needed], 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
- 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 systems that use a system-on-chip (SoC) design.[20]
Open Sound System version 4 is able to emulate ALSA.[21]
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.[22] ALSA API uses ioctl() calls in a way not allowed in the QNX kernel.[23]
See also
References
- ↑ "Jaroslav Kysela - Perex soft". https://www.perex.cz/perex/.
- ↑ Alsa Team, alsa-project.org, 2008-09-29, http://www.alsa-project.org/main/index.php/Alsa_Team, retrieved 2012-01-08
- ↑ "ALSA", Analysis Summary (Ohloh), http://www.ohloh.net/p/alsa, retrieved 2012-01-08
- ↑ 4.0 4.1 "Introduction". alsa-project.org. http://www.alsa-project.org/main/index.php/Introduction.
- ↑ Linux 2.5.5 release notes, https://www.kernel.org/pub/linux/kernel/v2.5/ChangeLog-2.5.5, retrieved 2012-01-08
- ↑ OSS Emulation, http://www.alsa-project.org/~tiwai/OSS-Emulation.html, retrieved 2012-07-07
- ↑ "Alsa-project/Alsa-tools". 3 April 2022. https://github.com/alsa-project/alsa-tools.
- ↑ "Alsa-tools - ALSA wiki". http://alsa.opensrc.org/index.php/Alsa-tools.
- ↑ "ALSA User Info - AlsaProject". https://www.alsa-project.org/wiki/ALSA_User_Info.
- ↑ "Alsa-utils". 4 May 2022. https://github.com/alsa-project/alsa-utils.
- ↑ "Category:Alsa-utils - ALSA wiki". http://alsa.opensrc.org/index.php/Category:Alsa-utils.
- ↑ 12.0 12.1 "How to Use ALSA Utilities to Manage Linux Audio from the Terminal". 14 May 2018. https://www.maketecheasier.com/alsa-utilities-manage-linux-audio-command-line/.
- ↑ 13.0 13.1 "AlsaMixers - ALSA wiki". http://alsa.opensrc.org/index.php/AlsaMixers.
- ↑ 14.0 14.1 14.2 boer, maarten de. "maarten's homepage". http://www.iua.upf.es/~mdeboer/. "this page will contain a list of my projects, but i need to clean up some things first. for now, use the following links, or browse the ftp: tapiir, alsamixergui, aconnectgui, polarbear"
- ↑ Boer, Maarten de. "AlsaMixerGui". Barcelona: Universitat Pompeu Fabra. http://www.iua.upf.es/~mdeboer/projects/alsamixergui/. "alsamixergui is a FLTK based frontend for alsamixer. It is written directly on top of the alsamixer source, leaving the original source intact, only adding a couple of ifdefs, and some calls to the gui part, so it provides exactly the same functionality, but with a graphical user interface. (Researcher, 1999-2010)"
- ↑ Tranter, Jeff (October 2004), "Introduction to Sound Programming with ALSA", Linux Journal, http://www.linuxjournal.com/article/6735, retrieved 2012-01-08
- ↑ Phillips, Dave (June 2005), "A User's Guide to ALSA", Linux Journal, http://www.linuxjournal.com/node/8234/print, retrieved 2012-01-08
- ↑ Alsa C library Doxygen documentation, October 2007, http://www.alsa-project.org/alsa-doc/alsa-lib/index.html, retrieved 2012-01-08
- ↑ "ALSA project - the C library reference: Sequencer interface". https://www.alsa-project.org/alsa-doc/alsa-lib/seq.html.
- ↑ ALSA SoC Layer, kernel.org, 2017-07-13, https://www.kernel.org/doc/html/latest/sound/soc/overview.html
- ↑ "Tips And Tricks - Open Sound System". http://www.opensound.com/wiki/index.php/Tips_And_Tricks#ALSA_Emulation.
- ↑ "Audio Architecture (QNX 6.4.1)". https://www.qnx.com/developers/docs/6.4.1/neutrino/audio/architecture.html.
- ↑ "ALSA and libasound.so". https://www.qnx.com/developers/docs/7.1/#com.qnx.doc.neutrino.audio/topic/copyright_3p.html.
External links
- Constable, Mark. "Alsa WIKI". https://alsa.opensrc.org/. "Some of the reasons this site remains in existence are, no one from the official ALSA site has ever contributed anything to this site (before the official one existed, this one predates the official wiki by quite a few years), no one has officially or formally suggested a merge, no one else has shown any serious interest in helping to merge them, and most importantly there are a significant number of offsite referers and Google hits that come directly to this site because it's been here for so long."
User mode | User applications | For example, bash, LibreOffice, GIMP, Blender, 0 A.D., Mozilla Firefox, etc. | ||||
---|---|---|---|---|---|---|
Low-level system components: | System daemons: systemd, runit, logind, networkd, PulseAudio, ... |
Windowing system: X11, Wayland, SurfaceFlinger (Android) |
Other libraries: GTK+, Qt, EFL, Software:Simple DirectMedia Layer|SDL]], SFML, FLTK,GNUstep|GNUstep]], etc. |
Graphics: Mesa, AMD Catalyst, ... | ||
C standard library | open() , exec() , sbrk() , socket() , fopen() , calloc() , ... (up to 2000 subroutines)glibc aims to be POSIX/SUS-compatible, musl and uClibc target embedded systems, bionic written for Android, etc. | |||||
Kernel mode | Linux kernel | stat , splice , dup , read , open , ioctl , write , mmap , close , exit , etc. (about 380 system calls)The Linux kernel System Call Interface (SCI, aims to be POSIX/SUS-compatible) | ||||
Process scheduling subsystem |
IPC subsystem |
Memory management subsystem |
Virtual files subsystem |
Network subsystem | ||
Other components: ALSA, DRI, evdev, Logical Volume Manager (Linux)|LVM]], device mapper, Linux Network Scheduler, Netfilter Linux Security Modules]]: SELinux, TOMOYO, AppArmor, Smack (Linux security module)|Smack]] | ||||||
Hardware (CPU, main memory, data storage devices, etc.) |
Original source: https://en.wikipedia.org/wiki/Advanced Linux Sound Architecture.
Read more |