AutoHotKey for toggling mute on audio devices
Raw-dogging it with AHK... Because Windows couldn't.
I really need to get a post out so I’ll just make a quick one about the what and why lol
I do enjoy streaming some games while capturing footage from my PS3; however, due to the cheap AliExpress capture card that I use(or some other external factor, I wouldn’t know) the audio that comes from the capture audio device is really shitty, so I had to resort to capturing a headphone output from my main monitor(on which I switch to my PS3 view to play games) back into my PC as line-in. This solution works for both streaming and playing games privately, but that also causes an unwanted side effect - when there’s no audio output, that line-in feed causes some noise which is audible to my headset when there’s no audio coming out of the PS3!
Granted I could just manually mute that inline device or disable the listening functionality, but I really wanted to have this on a button or something of that extent, so I wouldn’t need to fiddle around with Windows Audio manager settings every time I wanted to use this set-up.
Initially I wanted to do it all with Windows native functions, but I very quickly found out there was no easily-accessible command to control volume of audio devices, let alone toggling mute on them. Even PowerShell, which is supposed to be the oh so powerful answer to UNIX terminals wasn’t up to snuff!
So, I had to whip out my best botching tool yet:
AutoHotKey.
I have been reluctant on relying on AHK for a while, primarily because I plan to migrate to Linux once Windows 10 reaches EOL, but because in my line of programming work we’ve learned to do shit properly and do it once, instead of bodging. But then I realised, “wait a minute, I do this shit for myself, bodge away!”; and bodge away I did.
With this quick AutoHotKey script, I could easily toggle mute on an audio device volume(instead of switching to it and back in Volume Mixer as some Windows commands have suggested), and have it conveniently at two clicks!
Anyway, the code for the script is available as a Github gist here, you’ll probably need AutoHotKey in order to use it, which you can find here. Just note, that across computers audio devices and plugs may have different names, so you’ll want to adjust the name to match exactly the name of the audio device you wish to mute. This script should also be easily hackable to accomodate multiple devices, should the need arise for you.
Thanks for reading this blogpost, even though I have been a little inactive in posting them. I’ll try to get my Oculus Quest 2 review post sometime before May once I get my better headstrap for it but no promises because you know how it is lmfao