LinuxCommandLibrary

amixer

Control audio mixer settings from command line

TLDR

Turn up the master volume by 10%

$ amixer -D pulse sset Master [10%+]
copy

Turn down the master volume by 10%
$ amixer -D pulse sset Master [10%-]
copy

SYNOPSIS

amixer [options] [command]

Common usage examples:
amixer [options] scontrols
amixer [options] sget <SCONTROL>
amixer [options] sset <SCONTROL> <SVALUE>
amixer [options] cget <CCONTROL>
amixer [options] cset <CCONTROL> <CVALUE>

SCONTROL refers to a simple mixer control name (e.g., "Master", "PCM").
SVALUE specifies the value for a simple control (e.g., "50%", "on", "off", "mute").
CCONTROL refers to a complex (raw) mixer control identifier.
CVALUE specifies the value for a complex control.

PARAMETERS

-c <card>
    Specifies the sound card by its index or ID.

-D <device>
    Specifies the mixer device to control.

-q
    Enables quiet mode, suppressing output.

-i
    Displays card index in information output.

-h
    Displays the help message and exits.

-v
    Displays the version information and exits.

-s
    Saves control values (for sset command).

-R
    Restores control values (for sset command).

-F
    Reads/writes control values from/to a configuration file.

-V <view>
    Sets volume view mode (basic, exact, get-dB, get-percent).

-M
    Loads/saves master control file (.amixer.reg).

-E
    Loads/saves enum control file (.amixer.enum).

-S
    Displays controls in sorted alphabetical order.

-P
    Displays names of Playback controls only.

-C
    Displays names of Capture controls only.

-l
    Lists available sound cards.

-L
    Lists available mixer devices.

-r
    Prints raw output, suitable for parsing.

-B
    Enables batch mode for scripting, suppressing interactive prompts.

-I
    Enables interactive mode (not fully implemented in all versions).

-o <file>
    Redirects output to the specified file.

-t
    Displays timestamps with control information.

-T
    Displays control types (e.g., BOOLEAN, INTEGER).

-g
    Displays control groups (e.g., Playback, Capture).

-f
    Forces control names, useful with cget/cset for ambiguous names.

scontrols
    Lists simple mixer controls available on the selected device.

scontents
    Displays the current settings of all simple mixer controls.

sinfo
    Shows information about the simple mixer interface.

sget <SCONTROL>
    Retrieves the current value(s) of a specific simple control.

sset <SCONTROL> <SVALUE>
    Sets the value(s) of a specific simple control.

controls
    Lists all complex (raw) mixer controls.

contents
    Displays the current settings of all complex (raw) mixer controls.

info
    Shows information about the complex (raw) mixer interface.

cget <CCONTROL>
    Retrieves the current value(s) of a specific complex control.

cset <CCONTROL> <CVALUE>
    Sets the value(s) of a specific complex control.

DESCRIPTION

amixer is a versatile command-line utility for querying and adjusting mixer settings of
ALSA (Advanced Linux Sound Architecture) sound devices. It allows users to control
various aspects of their sound card, such as master volume, PCM levels, microphone
gain, and input/output source selection, directly from the terminal. Unlike graphical
mixers, amixer is ideal for scripting, remote administration, and automated audio
management tasks. It can interact with both simple controls, like common volume
sliders, and more complex, low-level hardware controls. Its robust capabilities make
it an essential tool for system administrators and advanced Linux users who need
precise control over their audio hardware.

CAVEATS

amixer can be challenging for beginners due to the varying names and types of controls across different sound cards.
Setting incorrect values may lead to no sound or unexpected audio behavior.
The distinction between simple (sget/sset) and complex (cget/cset) controls
requires understanding of ALSA's control interface, with simple controls typically
being easier to manage.

<B>SCRIPTING AND AUTOMATION</B>

amixer's command-line nature makes it highly valuable for inclusion in shell
scripts. It enables automated tasks such as setting default volume levels on system
startup, dynamically muting audio during specific events, or creating custom
keyboard shortcuts for precise volume adjustments. This capability is crucial for
system administrators and users requiring programmatic control over their audio setup.

<B>CONTROL NAMING CONVENTIONS</B>

Mixer controls are typically named descriptively (e.g., "Master", "PCM", "Capture",
"Headphone"). However, names can vary significantly depending on the sound
card's manufacturer and specific chip. Users might need to consult
amixer scontrols or the interactive alsamixer tool to identify the correct
control names for their particular hardware.

HISTORY

amixer is an integral part of the ALSA (Advanced Linux Sound Architecture)
project, which began development in 1997 as a successor to the then-dominant
OSS (Open Sound System). ALSA's goal was to provide more robust hardware
support, a modular architecture, and a modern API for sound management in Linux.
amixer emerged as the primary command-line tool for interacting with ALSA's mixer
subsystem, evolving over the years to support new audio hardware features and
complex control paradigms. It remains a fundamental utility for low-level audio
configuration and scripting in Linux environments.

SEE ALSO

Copied to clipboard