LinuxCommandLibrary

pamixer

Control audio volume from the command line

TLDR

List all sinks and sources with their corresponding IDs

$ pamixer --list-sinks --list-sources
copy

Set the volume to 75% on the default sink
$ pamixer --set-volume [75]
copy

Toggle mute on a sink other than the default
$ pamixer --toggle-mute --sink [ID]
copy

Increase the volume on default sink by 5%
$ pamixer [[-i|--increase]] [5]
copy

Decrease the volume on a source by 5%
$ pamixer [[-d|--decrease]] [5] --source [ID]
copy

Use the allow boost option to increase, decrease, or set the volume above 100%
$ pamixer --set-volume [105] --allow-boost
copy

Mute the default sink (use --unmute instead to unmute)
$ pamixer [[-m|--mute]]
copy

SYNOPSIS

pamixer [options]

PARAMETERS

--help
    Display usage information and exit.

--list-sinks
    List all available PulseAudio sinks (audio output devices).

--list-sources
    List all available PulseAudio sources (audio input devices).

--get-volume
    Get the current volume percentage of the selected sink.

--set-volume <N>
    Set the volume of the selected sink to N percent.

--increase <N>
    Increase the volume of the selected sink by N percent.

--decrease <N>
    Decrease the volume of the selected sink by N percent.

--toggle-mute
    Toggle the mute status of the selected sink.

--mute
    Mute the selected sink.

--unmute
    Unmute the selected sink.

--get-mute
    Get the mute status (0 for unmuted, 1 for muted) of the selected sink.

--default-sink <ID|Name>
    Set the default PulseAudio sink by its ID or name.

--default-source <ID|Name>
    Set the default PulseAudio source by its ID or name.

--get-default-sink
    Get the name of the current default sink.

--get-default-source
    Get the name of the current default source.

--sink <ID|Name>
    Perform the operation on the specified sink instead of the default one. Can be an ID or a part of the sink's name.

--source <ID|Name>
    Perform the operation on the specified source instead of the default one. Can be an ID or a part of the source's name.

--allow-boost
    Allow volume to be set above 100% (up to PulseAudio's maximum, typically 153%).

--print-volume
    Print the volume percentage after a change operation (e.g., increase, decrease, set).

--format <FORMAT_STRING>
    Specify the output format for volume/mute status using placeholders (e.g., {p} for percentage, {m} for mute status).
Example: pamixer --get-volume --format '{p}% {m}'

DESCRIPTION

pamixer is a lightweight command-line utility designed specifically for interacting with the PulseAudio sound server. It provides a straightforward and efficient way to control audio output (sinks) and input (sources) directly from the terminal, making it ideal for scripting, keyboard shortcuts, or users who prefer a non-graphical interface. Unlike more comprehensive PulseAudio tools like pactl or pacmd, pamixer focuses on common mixer operations such as adjusting volume levels, muting/unmuting devices, and setting default sinks/sources. Its simplicity allows for quick adjustments without delving into complex PulseAudio internals, offering a fast and convenient way to manage your audio.

CAVEATS

Requires PulseAudio to be running: pamixer interacts directly with the PulseAudio sound server. It will not function if PulseAudio is not active, or if your system uses a different sound server like ALSA directly or PipeWire without a PulseAudio compatibility layer.

Limited scope: While excellent for basic mixer controls, pamixer does not offer the advanced features of pactl or pacmd such as module loading, stream manipulation, or detailed client information.

<B>SCRIPTING AND INTEGRATION</B>

pamixer's straightforward syntax and single-purpose commands make it exceptionally well-suited for shell scripting. Users often integrate pamixer into their status bars (e.g., with i3status, polybar, or custom scripts) to display current volume and mute status, and configure keyboard shortcuts to quickly adjust audio levels, toggle mute, or switch audio devices. Its output can be easily parsed, further enhancing its utility in automated tasks.

HISTORY

pamixer emerged as a simpler, more user-friendly alternative to the sometimes verbose and complex pactl for common volume and mute operations within the PulseAudio ecosystem. Its development reflects a common trend in command-line tools towards focused functionality and ease of use, particularly beneficial for integration into shell scripts, custom keybindings, and minimalist desktop environments. It provides a quick way to control the PulseAudio server without needing to parse complex pactl outputs or invoke a full interactive shell with pacmd.

SEE ALSO

pactl(1), pacmd(1), alsamixer(1), amixer(1), pulseaudio(1)

Copied to clipboard