1. Introduction

Muting the microphone prevents the transmission of unintended background noise or private conversations. On the other hand, quickly unmuting enables us to actively participate in discussions when needed.

In this tutorial, we’ll discuss the amixer, pactl, and pacmd commands to effectively mute and unmute the microphone in the Linux operating system (OS).

Understanding this feature could be very handy especially if we’re in an online meeting using any VoIP application.

2. Using the amixer Command

The amixer command interacts with the Advanced Linux Sound Architecture (ALSA) to adjust various audio parameters. The ALSA framework is an open-source project and part of the Linux kernel, enabling communication between the OS and the audio hardware.

Of course, we may need to first install the ALSA utility package before using the amixer command. The installation varies on different Linux distributions. For example, we can install it on Ubuntu via apt:

$ sudo apt install alsa-utils

Next, we can mute the microphone:

$ amixer set Capture nocap

Here, Capture is the control name typically associated with the microphone settings, while the nocap option mutes the microphone by disabling it. As a result, we disabled the microphone, so no audio input would be possible via this device.

Next, to unmute the microphone, we can use cap:

$ amixer set Capture cap

The cap option unmutes the microphone by enabling it.

We can also reverse the current state of the microphone:

$ amixer set Capture toggle

The toggle option disables the microphone if it’s currently enabled and vice versa.

3. Using the pactl Command

The pactl command primarily interacts with the PulseAudio sound server which sits on top of ALSA for hardware support to perform audio functionalities.

We usually need the microphone’s index number to mute and unmute using the pactl command. The index number is a unique identifier assigned to each audio source to manage its functions.

We can display a short concise list of all available audio sources along with their index numbers via the sources category:

$ pactl list short sources
0	alsa_output.pci-0000_02_02.0.analog-stereo.monitor ...
1	alsa_input.pci-0000_02_02.0.analog-stereo ...

Here, the microphone index number is 1.

Now, we can mute or unmute the microphone with that index number:

$ pactl set-source-mute 1 toggle

The set-source-mute option controls the current mute status of the microphone and reverses it using the toggle option.

4. Using the pacmd Command

The pacmd command also deals with the PulseAudio sound server like pactl. Unlike pactl, the pacmd provides more advanced functionalities such as scripting audio configuration and debugging PulseAudio problems.

Again, we often need the microphone’s index number to use the pacmd command. To get that, we can either use the pactl command like we did earlier or we can use pacmd to find the index number via the list-sources subcommand:

$ pacmd list-sources

This command displays detailed information about available audio sources.

Now, we can use the set-source-mute option of pacmd to unmute the microphone:

$ pacmd set-source-mute 1 0

Here, 1 is the microphone’s index number while 0 is used to unmute it.

Now, we mute the microphone:

$ pacmd set-source-mute 1 1

Here, we’ve replaced 0 with 1 to mute the microphone.

5. Conclusion

In this article, we discussed the amixer, pactl, and pacmd commands to mute and unmute the microphone. The amixer uses the ALSA utility package whereas pactl and pacmd use PulseAudio sound server.

While all these commands can effectively mute and unmute the microphone, the difference lies in their overall functionality. We can perform basic audio control tasks using amixer and pactl whereas pacmd provides more options and features to manage audio settings.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.