-
-
Save airstrike/5cb66c97a288efdb578a to your computer and use it in GitHub Desktop.
; | |
; AutoHotkey Version: v1.1.22.06 | |
; Language: English | |
; Platform: Windows 10 | |
; Author: Andy Terra <github.com/airstrike> | |
; | |
; Script Function: | |
; Toggle Microphone Mute -- assumes it is located at WAVE:1, device #2 | |
; Use the SoundCardAnalysis script to figure out where your mic is | |
; https://www.autohotkey.com/docs/commands/SoundSet.htm#Ex | |
; | |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
#SingleInstance force | |
MuteMic() { | |
local MM | |
SoundSet, +1, WAVE:1, MUTE, 2 | |
SoundGet, MM, WAVE:1, MUTE, 2 | |
#Persistent | |
ToolTip, % (MM == "On" ? "Microphone muted" : "Microphone online") | |
SetTimer, RemoveMuteMicTooltip, 700 | |
return | |
} | |
RemoveMuteMicTooltip: | |
SetTimer, RemoveMuteMicTooltip, Off | |
ToolTip | |
return | |
#u::MuteMic() |
Hello! I'm a bit new to coding. This script works great and is the best I could find, thanks. But the same issue persists as with all the other scripts. This only mutes sound coming from my PC (Spotify) and does not mute the sound going into it (my voice). I'm not sure if this was because of the "WAVE::1" part of the script as i'm not sure what to change it to :/ but idk. I'll attach a screenshot of the script and the soundcard information. I'd appreciate any help and insight help a whole lot ^_^
P.S The Master 3 at 79 settings is what i'm trying to get a toggle mute function on and i'm on windows 10.
Hello, where can I find the AudioFinder script?
@Says47 Hello, where can I find the AudioFinder script?
Check AutoHotkey docs. Move the cursor over the code and press the appeared "Download code" button in the top right corner:
Tip I found on ahk forums: before starting the script, set the mic volume to something unusual to make it easy to find:
@Hassanut I'd appreciate any help and insight help a whole lot ^_^
It's an almost 2 years old question… but maybe it can be helpful for future visitors too.
The window says it's a "MASTER" device, not "WAVE". So the part of code should be like this:
SoundSet, +1, MASTER:1, MUTE, 2
SoundGet, MM, MASTER:1, MUTE, 2
The command params represent the following columns:
SoundGet/SoundSet, <Setting>, <Component Type>, <Control Type>, <Mixer>
Thanks very much! <3
Yes! The age old question has been answered.
I honestly don't even remember writing this script and must have totally missed the notifications 2 years ago, or else I would have responded, sorry! Also had no idea this had 6 stars or people actually used it, but glad to hear all questions have been solved. Thanks, @OddMorning for your valuable tips!
It doesn't work for me (I'm trying on audacity with an external mic, it records my voice when muted or not, with and without OddMorning modification).
@WiliTest what do you see in the AudioFinder script dialog? Your control may not be named MASTER or WAVE, you'd have to check
it's working! Thanks a lot for your time! (I made a slight improvement using permanent notifications, and my code works when the micro change mixers/channels)
I struggled with 2 problems (solution below)
- How to find out the number we should add after
MASTER: ...
(I guess it's not the same as the Mixer. Is it always1
?) - each time I plug/unplug my external micro (which I often have to do) the mixer's number changes from 8 to 10. Is there a way to make it stable? (I don't have this problem when I turn off Bluetooth)
Solutions:
-
i simply used
master
(without any number). -
Simply double your code for each volume mixer your micro uses
SoundGet, master_mute8, , mute, 8
SoundGet, master_mute10, , mute, 10
colore = % (master_mute8 == "On" ? "cwred":"cwgreen")
texte= % (master_mute8 == "On" ? "8Ø":"8✔")
Splashimage 1: ,b +x1200 +y895 w50 h25 %colore%, %texte%
colort = % (master_mute10 == "On" ? "cwred":"cwgreen")
textt = % (master_mute10 == "On" ? "10Ø":"10✔")
Splashimage 2: ,b +x1200 +y930 w60 h25 %colort%, %textt%
#u:: ; Ctrl-Alt-M is my chosen hotkey
; Taken from here: https://www.autohotkey.com/boards/viewtopic.php?t=15509
;Control panel > Sound > Recording > Select headset > Properties > Levels > Change > Apply
SoundSet, +1, MASTER, mute, 8
SoundGet, master_mute8, , mute, 8
SoundSet, +1, MASTER, mute, 10
SoundGet, master_mute10, , mute, 10
colore = % (master_mute8 == "On" ? "cwred":"cwgreen")
texte= % (master_mute8 == "On" ? "8Ø":"8✔")
Splashimage 1: ,b +x1200 +y900 w50 h25 %colore%, %texte%
colort = % (master_mute10 == "On" ? "cwred":"cwgreen")
textt = % (master_mute10 == "On" ? "10Ø":"10✔")
Splashimage 2: ,b +x1200 +y930 w60 h25 %colort%, %textt%
return
Hello! I'm a bit new to coding. This script works great and is the best I could find, thanks. But the same issue persists as with all the other scripts. This only mutes sound coming from my PC (Spotify) and does not mute the sound going into it (my voice). I'm not sure if this was because of the "WAVE::1" part of the script as i'm not sure what to change it to :/ but idk. I'll attach a screenshot of the script and the soundcard information. I'd appreciate any help and insight help a whole lot ^_^
P.S The Master 3 at 79 settings is what i'm trying to get a toggle mute function on and i'm on windows 10.