20

How can I mute the microphone using AutoHotkey?

Here's why I need it:

Whenever someone walks in my office, I have to pause the media player. Sometimes, when I'm watching a video, I also have to mute the headphone speakers. And if I'm on a Skype call, I have to mute the microphone.

I want to assign all those functions to a single hotkey for convenience (probably the "mute" or "play/pause" key) and I'm pretty sure AutoHotkey can do that, but I don't know how to mute the microphone using AutoHotkey.

Plus, I also want to assign all reverse commands (play and unmute) to a single key (could be a different one or the same one).

(I don't think it matters, but I'm using Windows 7.)

Malabarba
  • 8,998

9 Answers9

10

Use:

#z::
soundget, isMute, MICROPHONE, MUTE
if isMute = Off
    toMute = 1
else
    toMute=0
SoundSet, toMute, MICROPHONE, MUTE
return

It would toggle the microphone's muted state on win&z. Muting the master volume would be much the same, except instead of MICROPHONE you would put MASTER. However, if it's just your media player you want muting, it may be better to set up a hotkey to pause it, rather than mute the system volume. Depending on the player, it may be able to do it itself, otherwise look into the ControlSend function.

(This has the advantage of not using NirCMD, as while it's a brilliant tool, the approximately 0.5 second disk lag is really annoying to me :()

Phoshi
  • 23,483
9

I would recommend 'MicMute' utility to mute or unmute the primary microphone using a keyboard. It has a nice taskbar icon, taskbar balloons, and auditory notifications you can modify.

What's awesomer it also let me select my keyboards extended media keys as a shortcut - I choose the button next to my system volume mute.

MicMute Keyboard Muting of Windows Microphone

5

A microphone muting utility is TorkilsMicMuter:

Shortcut key is configurable as is the signalling of the current mute state:

Configuration

Semitransparent corner notifications on all monitors of current mute state. If a corner notification is "in the way" during an online meeting, then the notification can easily be removed by hovering the mouse over it.

Corner notifications

toe
  • 81
4

To extend Phoshi's answer, using AutoHotkey and this script can help (Ctrl + F8):

^F8::
SoundSet, +1, MICROPHONE, mute
return

In my case though, it was the following:

SoundSet, +1, MASTER, mute, 12

This might help to get exact audio device configuration: https://autohotkey.com/docs/commands/SoundSet.htm#Ex

Corio
  • 232
3

You can do this, and much more, by using NirCMD along with AutoHotkey.

Take a look at NirCmd - Windows command line tool:

NirCmd is a small command-line utility that allows you to do some useful tasks without displaying any user interface. By running NirCmd with simple command-line option, you can write and delete values and keys in the Registry, write values into INI file, dial to your internet account or connect to a VPN network, restart windows or shut down the computer, create shortcut to a file, change the created/modified date of a file, change your display settings, turn off your monitor, open the door of your CD-ROM drive, and more...

J Sidhu
  • 614
2

Very simple:

  1. Go to your Skype
  2. Select Tools
  3. Select option
  4. Click advance below
  5. Then click Hotkeys
  6. Check Enable keyboard shortcuts
  7. Check mute microphone..and click it
  8. Then select an additional key you want in muting the microphone.. like CTRL + Z... CTRL + D... any key you want to choose
  9. Finally, click Save..
Lee Taylor
  • 1,506
1

I have set Ctrl + P to toggle the system sound. For Window + Z, it would be:

#z::Send {Volume_Mute}

Abbas
  • 289
0

In 2024, the new way (Windows 11 and later) of doing this is to not use nircmd—as it does not always get the default microphone right. We all use multiple devices now: a jack microphone, a Bluetooth headset and the built-in array microphone. Switching between these is cumbersome and the nircmd command mutesysvolume or even mutesubunitvolume does not always get it right anymore.

The developer of nircmd has another, sound-specific tool SoundVolumeView; just search for it.

Then instead of Run nircmd.exe mutesysvolume ... do Run "C:\<YOUR PATH>\SoundVolumeView.exe" /Switch "{0.0.1.00000000}.{e158d5de-1989-4661-b345-bb10XXXX}" <- this latter part is the device ID. You can get this through the SoundVolumeView user interface. Or just right-click any device and select Copy Mute/Unmute command.

-1

Here is a sample AutoHotkey command to use nircmd to mute a microphone. You will have to play around with the number at the end; it refers to the microphone number.

#z:: Run c:\tools\nircmd\nircmd.exe mutesysvolume 2 microphone 2

Press Windows + Z to toggle mute.

bryan
  • 8,528
  • 4
  • 30
  • 42