Skip to content

Instantly share code, notes, and snippets.

@Arty2
Created April 16, 2020 06:19
Show Gist options
  • Save Arty2/ce943769f33f307375bfcbe75b0300b8 to your computer and use it in GitHub Desktop.
Save Arty2/ce943769f33f307375bfcbe75b0300b8 to your computer and use it in GitHub Desktop.
An AutoHotKey script to mute/unmute all microphones on a system level. Works with Windows 10.
; An AutoHotKey script to mute/unmute all microphones on a system level. Toggle with Caps Lock.
; Emits a single beep on mute, double on unmute. Tray icon changes accordingly.
; Requires https://www.nirsoft.net/articles/mute_microphone_command_line.html
; Note: SoundSet doesn't work as intented
; TODO: detect tap and hold to speak, based on https://github.com/YoYo-Pete/AutoHotKeys/blob/master/PushToTalk.ahk
; https://www.howtogeek.com/446418/how-to-use-caps-lock-as-a-modifier-key-on-windows/
; also https://stackoverflow.com/questions/1794258/detect-a-double-key-press-in-autohotkey
$Capslock::
toggle := !toggle
If toggle {
Sleep 500 ; mute with a small delay to avoid cut-off words
SoundBeep, 500
Menu, Tray, Tip, Mic Muted
Menu, Tray, Icon, SndVol.exe, 3, 1
Run "C:\portable\SoundVolumeView\SoundVolumeView.exe" /Mute "DefaultCaptureDevice"
}
else {
SoundBeep, 900
SoundBeep, 900
Menu, Tray, Tip, Mic Active
Menu, Tray, Icon, SndVol.exe, 2, 1
Run "C:\portable\SoundVolumeView\SoundVolumeView.exe" /Unmute "DefaultCaptureDevice"
}
Return
@Arty2
Copy link
Author

Arty2 commented May 2, 2020

Although useful in a pinch, this script is not very reliable. On computers with multiple microphone devices, it only motes the default and going through all available devices doesn't seem easy or effective.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment