How to Use ALSA Utilities to Manage Linux Audio from the Terminal

The Advanced Linux Sound Architecture (ALSA) provides Linux computers with audio support. Popular distros such as Ubuntu and Arch Linux run it by default, so there’s a good chance you’re using it right now to play music through your speakers or headphones.

In this article we’ll show you two ways to adjust the volume of that playback by using the Alsamixer and Amixer utilities.

The installation for this project is minimal. Both Alsamixer and Amixer should arrive as part of the Alsa-utils package. Run these commands to install that package:

Ubuntu:

Arch Linux:

The easier of the two utilities to use is Alsamixer. It works as part of an Ncurses interface, which allows you to remain in the terminal but provides a graphical representation of your sound card and its properties.

Running that command will show you something like what is pictured in the following image.

Alsamixer default

Here you can see at the top of my screen the name of my sound card, the type of view I’m in, and the item that’s currently selected. You can change those options at your will.

Sound Card Selection

You can select a different sound card by pressing F6. It will bring up a menu that shows the known sound cards on your system. You can also enter the name of a sound card if it isn’t shown in the menu.

Alsamixer sound card selection

Views

You can change your view to see different controls for what volume options ALSA can control. The default you see above is the “Playback” view. You can choose “Capture” by pressing F4 and “All” (which includes “Playback” and “Capture”) by pressing F5. Return to “Playback” with F3.

“Capture” view

Alsamixer "capture" view

“All” view

Alsamixer "all" view

Movement and Volume Adjustment

Each type of view may have more options than you see in the screenshots here. Move right and left, respectively, through those options by pressing the Left and Right arrow keys.

Adjust each volume with Down or PgDown to reduce the volume of a channel and Up or PgUp to increase the volume.

You can mute any channel by pressing m.

Check out the full view of options by pressing F1 to get the screen pictured below.

Alsamixer help dialogue

With Amixer you don’t get a graphical environment. Instead, you use commands to set the various volumes of each channel for your sound cards.

View your available options and commands with amixer help.

Amixer help dialogue

Then look at your available controls with amixer scontrols.

Amixer scontrols command

These are the audio controls you can change. You can adjust them with various commands that follow the basic pattern of amixer -c <card-number> set <control> <value>.

  • Set the Master volume on the first sound card to 100%: amixer -c 0 set Master 100%
  • Set the Master volume on the second sound card to 50%: amixer -c 1 set Master 50%
  • Set the Mic volume on the first sound card to five decibels: amixer -c 0 set Mic 5db
  • Increase the Mic volume on the first sound card two decibels : amixer -c 0 set Mic 2db+
  • Mute the Master control on the first sound card: amixer -c 0 set Master mute
  • Unmute the Master control on the first sound card: amixer -c 0 set Master unmute

Output for these commands should produce something that looks like the following image.

Amixer set master command

There is more you can do with amixer, including setting your volumes to specific hardware value and modifying the audio channels to change, such as front, rear, center, and woofer channels. Read the manual page with man amixer to dig deeper into those advanced controls.

You should now have a basic understanding of how to use Alsamixer and Amixer to control the volume levels on your sound card.

I use Alsamixer often when I switch from desktop speakers to headphones on my laptop. It saves my ears several times a week. You may find similar uses for these tools, and hopefully you find them as intuitive and easy to use as they were meant to be.

Leave a Reply

Yeah! You've decided to leave a comment. That's fantastic! Check out our comment policy here. Let's have a personal and meaningful conversation.