Linux amixer Command with Practical Examples

LinuxLinuxBeginner
Practice Now

Introduction

In this lab, you will learn how to use the amixer command, a command-line tool for controlling sound card mixer settings in Linux. The lab covers adjusting the master volume, controlling specific sound channels, and other practical examples of using amixer. You will explore how to check the current mixer settings, adjust the master volume, and manage individual sound channels, providing a comprehensive understanding of this essential Linux audio utility.

Linux Commands Cheat Sheet


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) linux/UserandGroupManagementGroup -.-> linux/set("`Shell Setting`") subgraph Lab Skills linux/set -.-> lab-422543{{"`Linux amixer Command with Practical Examples`"}} end

Introduction to amixer Command

In this step, you will learn about the amixer command, which is a command-line tool used to control sound card mixer settings in Linux. The amixer command allows you to adjust the volume, balance, and other settings of your sound card.

First, let's check the current sound card mixer settings using the amixer command:

amixer

Example output:

Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 65536 [100%] [0.00dB] [on]
  Front Right: Playback 65536 [100%] [0.00dB] [on]

This output shows the current settings for the 'Master' mixer control, including the volume level and mute status for the front left and right channels.

You can use the amixer command to adjust the volume of the 'Master' control:

amixer set Master 50%

Example output:

Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 32768 [50%] [-6.00dB] [on]
  Front Right: Playback 32768 [50%] [-6.00dB] [on]

This command sets the 'Master' volume to 50%.

Now, let's explore how to control specific sound channels using amixer.

Adjusting Master Volume with amixer

In this step, you will learn how to adjust the master volume of your sound card using the amixer command.

First, let's check the current master volume level:

amixer get Master

Example output:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 65536
  Mono: Playback 65536 [100%] [0.00dB] [on]

This shows that the master volume is currently set to 100%.

To adjust the master volume, you can use the amixer set command. For example, to set the master volume to 50%:

amixer set Master 50%

Example output:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 65536
  Mono: Playback 32768 [50%] [-6.00dB] [on]

You can also use absolute values instead of percentages. For example, to set the master volume to the maximum level:

amixer set Master 65536

Example output:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 65536
  Mono: Playback 65536 [100%] [0.00dB] [on]

And to mute the master volume:

amixer set Master mute

Example output:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 65536
  Mono: Playback 65536 [100%] [0.00dB] [off]

To unmute the master volume:

amixer set Master unmute

Example output:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 65536
  Mono: Playback 65536 [100%] [0.00dB] [on]

Now you know how to adjust the master volume using the amixer command.

Controlling Specific Sound Channels with amixer

In this step, you will learn how to control the volume of specific sound channels using the amixer command.

First, let's check the available sound channels on your system:

amixer scontrols

Example output:

Simple mixer control 'Master',0
Simple mixer control 'Headphone',0
Simple mixer control 'Speaker',0
Simple mixer control 'PCM',0
Simple mixer control 'Capture',0

This shows that there are several available sound channels, including 'Master', 'Headphone', 'Speaker', 'PCM', and 'Capture'.

To adjust the volume of a specific channel, you can use the amixer sset command. For example, to set the 'Headphone' channel volume to 50%:

amixer sset Headphone 50%

Example output:

Simple mixer control 'Headphone',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 32768 [50%] [-6.00dB] [on]
  Front Right: Playback 32768 [50%] [-6.00dB] [on]

You can also mute or unmute a specific channel:

amixer sset Headphone mute
amixer sset Headphone unmute

Example output:

Simple mixer control 'Headphone',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 65536 [100%] [0.00dB] [off]
  Front Right: Playback 65536 [100%] [0.00dB] [off]

Simple mixer control 'Headphone',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 65536 [100%] [0.00dB] [on]
  Front Right: Playback 65536 [100%] [0.00dB] [on]

Now you know how to control the volume of specific sound channels using the amixer command.

Summary

In this lab, you learned about the amixer command, which is a command-line tool used to control sound card mixer settings in Linux. You started by checking the current sound card mixer settings using the amixer command and then learned how to adjust the volume of the 'Master' control. Additionally, you explored how to control specific sound channels using amixer.

You discovered that the amixer command allows you to adjust the volume, balance, and other settings of your sound card. You learned how to set the master volume to a specific level, such as 50%, using the amixer set command. This provides you with the ability to fine-tune the audio output on your Linux system.

Linux Commands Cheat Sheet

Other Linux Tutorials you may like