How to use the command pamixer (with examples)

How to use the command pamixer (with examples)

Pamixer is a simple command-line mixer for PulseAudio, a sound server that handles audio on Linux systems. It allows users to control volume levels, mute or unmute audio sources, and list available sinks and sources.

Use case 1: List all sinks and sources with their corresponding IDs

Code:

pamixer --list-sinks --list-sources

Motivation: This use case is useful when you want to see the available audio devices, including both output sinks (e.g., speakers) and input sources (e.g., microphones). It helps you identify the specific IDs of sinks and sources to use in subsequent commands.

Explanation: The --list-sinks option lists all the output sinks, while the --list-sources option lists the input sources. Running the command with both options provides a complete overview of all available sinks and sources.

Example output:

Sinks:
0: alsa_output.pci-0000_00_1b.0.analog-stereo (Built-in Audio Analog Stereo)

Sources:
0: alsa_input.pci-0000_00_1b.0.analog-stereo (Built-in Audio Analog Stereo)
1: alsa_input.pci-0000_00_14.2.analog-mono (Front Microphone)
2: alsa_input.pci-0000_00_14.2.analog-stereo (Rear Microphone)

Use case 2: Set the volume to 75% on the default sink

Code:

pamixer --set-volume 75

Motivation: This use case allows you to quickly set the volume level to a desired percentage on the default output sink. It is useful when you want to adjust the volume without using a graphical user interface.

Explanation: The --set-volume option is used to set the volume level. Here, we provide the value 75 to set it to 75%. If you have multiple output sinks, this command will only affect the default one.

Example output: None

Use case 3: Toggle mute on a sink other than the default

Code:

pamixer --toggle-mute --sink ID

Motivation: If you have multiple output sinks and want to quickly mute or unmute a specific sink, this use case comes in handy. It allows you to toggle the mute state on a sink other than the default one.

Explanation: The --toggle-mute option is used to mute or unmute the specified sink. Replace ID with the actual ID of the sink you want to target. You can find the sink ID by running the command from Use case 1.

Example output: None

Use case 4: Increase the volume on default sink by 5%

Code:

pamixer --increase 5

Motivation: When you want to incrementally increase the volume on the default output sink, this use case is useful. It provides a convenient way to boost the volume by a specific percentage.

Explanation: The --increase option is used to increase the volume. Here, we specify the value 5 to increase it by 5%. If you have multiple output sinks, this command will only affect the default one.

Example output: None

Use case 5: Decrease the volume on a source by 5%

Code:

pamixer --decrease 5 --source ID

Motivation: If you want to decrease the volume on a specific input source, this use case is helpful. It allows you to adjust the volume level of a microphone or other audio input device.

Explanation: The --decrease option is used to decrease the volume. We provide the value 5 to decrease it by 5%. Replace ID with the actual ID of the source you want to target. You can find the source ID by running the command from Use case 1.

Example output: None

Use case 6: Use the allow boost option to increase, decrease, or set the volume above 100%

Code:

pamixer --set-volume 105 --allow-boost

Motivation: The allow boost option is useful when you need to increase, decrease, or set the volume above 100%. It provides extended control of volume levels if your setup allows boosting.

Explanation: By default, Pamixer restricts the volume level to a maximum of 100%. However, adding the --allow-boost option overrides this limitation. In this use case, we set the volume to 105% by providing 105 as the value and enable the boost feature.

Example output: None

Use case 7: Mute the default sink

Code:

pamixer --mute

Motivation: When you want to quickly mute the audio on the default output sink, this use case is handy. It allows you to conveniently mute the sound without using a graphical interface.

Explanation: The --mute option is used to mute the audio on the default output sink. When the sink is muted, no sound will be produced. To unmute, you can use the --unmute option instead.

Example output: None

Conclusion:

Pamixer is a versatile command-line tool for managing audio levels and sources in PulseAudio. With its simple syntax and various options, you can easily adjust volume levels, mute or unmute audio, and get an overview of available sinks and sources. By familiarizing yourself with these use cases, you can confidently control your audio settings directly from the command line.

Related Posts

Analyzing Network Interference with ooniprobe (with examples)

Analyzing Network Interference with ooniprobe (with examples)

The ooniprobe command is a powerful tool provided by the Open Observatory of Network Interference (OONI) project.

Read More
How to use the command pbmtoxbm (with examples)

How to use the command pbmtoxbm (with examples)

Pbmtoxbm is a command-line tool that converts portable bitmap (PBM) images to X11 bitmap format (XBM).

Read More
How to use the command popd (with examples)

How to use the command popd (with examples)

The popd command is used to change the current directory to the directory stored by the pushd command.

Read More