I’ve recently upgraded to a mechanical keyboard, and I have to say I’m an addict. The tactile response makes typing on a standard rubber-dome feel like mashing on jello. One problem, however, is that when I’m in a Google Talk/Skype session, typing on the keyboard can be heard through my microphone with the subtlety of an AK-47.
“Yeah, sure, let me look that up here qui…CLACK CLACK CLACK CLACK CLACK”
Find a free, quick and lightweight way to automatically mute my microphone when I start typing on the keyboard. My solution is an AutoHotkey script that does exactly that.
While this script is designed to mitigate the clicking passed through a mechanical keyboard and desktop microphone, I think it would have similar benefit with laptops and a built-in mic, as typing on the laptop can be loud through the mic in my experience.
Prerequisites/Before You Begin
OS: Windows 7/Windows Vista
Skills: Ability to unzip files and navigate file system
The AutoHotkey libraries I use in my solution depends on a Vista or Windows 7 workstation. In order to make this work for Windows XP you would need to use an XP-compatible volume library, and I unfortunately don’t have an XP box to find and test that.
You will have to edit the AutoHotkey script I provide in order to make it work for your specific machine, so AutoHotkey or general scripting experience would be extremely helpful. I will, however, try to make things easy for anyone not familiar with AutoHotkey, and feel free to post any questions in the comments.
The following is all the software you will need to complete this project. Note that you will have to edit the script MuteOnKeypress to accommodate your specific microphone, as I will describe in this post.
- AutoHotkey – Installer for AutoHotkey_L (latest version)
- Vista Audio Control Functions for AutoHotkey – library for AutoHotkey that lets us use volume controls on a Vista or Windows 7 machine
- CaptureDeviceList – AutoHotkey script (zipped) for discovering what microphone our system uses, based off topology2.ahk
- MuteOnKeypress – AutoHotkey script (zipped) that we will run whenever we want the microphone to mute when there’s keyboard activity
Step 1: Download and Install AutoHotkey
Step 2: Install the Vista Audio Control Functions
Once downloaded, unzip the VA21.zip to a folder, which should leave you with two files: VA.ahk and VA.html. The HTML file contains the VA manual, but VA.ahk is what we’re interested in.
Next, find the installation directory of AutoHotkey. This should be under My Computer -> C:/Program Files/AutoHotkey. Once there, create a new folder called Lib. Open the newly-created Lib folder and copy the VA.ahk file into there.
What we’ve done is moved the Vista Audio Control Functions library into the AutoHotkey Lib folder so that AutoHotkey knows where to look for the volume control functions when our scripts need them.
Step 3: Verify Vista Audio Control Functions
Next you will want to download and unzip the CaptureDeviceList AutoHotkey file. When you execute the file CaptureDeviceList.ahk, you should see something similar to this:
If, however, you see something like this:
That means that you don’t have the Vista Audio Control Functions file VA.ahk in the C:/Program Files/AutoHotkey/Lib folder like it should be (see Step 2). If you can’t even get CaptureDeviceList.ahk to run, you most likely have an AutoHotkey installation error.
Once you can successfully see the device list, we’re ready to move on to the last step.
Step 4: Run MuteOnKeypress
Download and unzip MuteOnKeypress. Run script by double-clicking on the .ahk file and an AutoHotkey icon should remain in your system tray as long as the script is running. No editing of the MuteOnKeypress.ahk file should be necessary.
Now whenever there is keyboard activity, the system will mute the microphone for 1 second from the last keypress.
The easiest way I found to test the script is to open Sound Recorder (Start -> All Programs -> Accessories -> Sound Recorder) and see what the green bar looks like when I talk then start typing. If everything is working properly, the bar should drop to zero once you start typing, then pick up again after not typing for more than one second (as long as you’re continually talking or blowing on the mic).
I’ve found in my tests that the first click of the keyboard is still heard over the mic before the system mutes the microphone. However, this is a huge, huge improvement from the loud clicking that was previously passed over the voice chat session when I typed.