Toggle System Microphone Macros

Howdy folks,

There are several options floating around out there for muting and unmuting the system microphone, but here is the method I use. The thing I like about mine is it puts a “status indicator” in the menu bar by using KM 10’s menu bar icon feature. When you mute the microphone, it sets a named clipboard (System Microphone) to a microphone icon with a red background, and when you unmute it, a green background. The macro group is set to display that named clipboard, with it’s icon, so when the microphone is toggled, the icon updates automatically in the menu bar.

The macro group includes four macros, one to toggle, one to mute, one to unmute, and one that periodically checks the mic status and updates the clipboard just in case it gets out of sync for some reason. Likely the only one most people would use is to toggle the microphone, but the other three are there in case you want to use them via an execute a macro action or some other means.

More details and screenshots are below. As usual, feel free to share any comments or suggestions, or to let me know if it doesn’t work for you.

NOTE: For some reason the screenshots are not showing the macro icons nor the icon in the clipboard actions. If for some reason, upon installing the macros, the icons aren’t there, simply choose your own from the icon picker (activated via ⌘3 by default).

-Chris

System Microphone Macros.kmmacros (17.0 KB)

Macro Screenshots (click to expand/collapse)

Macro Group Settings

Toggle Mute Macro

Mute Macro

Unmute Macro

Check Mic Status Macro

Menu Bar Icon Screenshots (click to expand/collapse)

Unmuted

Muted

CURRENT VERSION: 2.0.0 (Friday, October 27, 2023)

Version History

v2.0.0 Friday, October 27, 2023
Updated macro set with a simplified toggle macro and additional check status macro

v1.0.0 Tuesday, September 5, 2023
Initial macro

RELEASE NOTES, INSTRUCTIONS AND DISCLAIMER

Purpose of this macro (click to expand/collapse)

Toggle the system’s microphone.

How this macro works (click to expand/collapse)

A shell script toggles the system microphone input volume via AppleScript.

How to use this macro (click to expand/collapse)

Import and enable the macro group. Change the hotkeys and/or icons if necessary.

How to configure this macro (click to expand/collapse)

No configuration necessary.

Disclaimer (click to expand/collapse)

TL;DR: I built it and it works for me. You can share/modify it how you want. But don't blame me if it doesn’t work for you :laughing:

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

6 Likes

Interestingly, I nearly added a Mute/Unmute Microphone action for v11, but decided I could not do it because the system has no visual indication of the mute status, and if you muted it in Keyboard Maestro and then forgot you'd have no idea why your microphone was not working!

So great job on finding a way to do this relatively safely.

2 Likes

Thanks Peter! For a long time I’ve been using Mic Drop since it has a live on-screen monitor, and I still use it for work because I need a larger visual indication of my mic’s status. But I came up with this method quite a while ago for those times where I didn’t need the larger indicator. Of course, it wouldn’t be possible without those menu bar icons, so thanks for implementing those with v10!

2 Likes

Hi, @cdthomer.

Does this turn off your microphone for your entire system, including all apps and browsers? (For those of us looking for something like this with privacy and security concerns in mind.)

If you have multiple microphones, e.g. one on your laptop and one on an external monitor, does this turn off every one of these microphones?

Is there a similar macro that can do the same for your webcam or webcams?

Hi @alexcr, yes it “turns off” your microphone system-wide, in the sense that it sets the input volume to 0. So technically the connection is still active, there’s just no audio transmitted through the input channel. The result is that no matter what microphone you’re using, it mutes it.

FYI I just uploaded version the 2.0.0 group which contains a simplified toggle macro and additional status check macro if you’re interested in trying out the updated version.

-Chris

1 Like

Thanks, @cdthomer. Yeah, I'd be curious to check it out! Is there a link to the post?

Is it possible to do a similar macro for webcams? (That is, a macro that ensures that your system, apps, browsers, etc. are unable to access your webcam or webcams?)

It's in the original post up above.

Not that I’m aware of, unfortunately. :slightly_frowning_face:

1 Like

Am I right in thinking that the Toggle macro requires two presses of the assigned hot key, one to mute and one to unmute? I was looking for a cough button when podcasting, and it would be great if this macro could be adjusted to trigger once on key down and once on key up, although I have no idea how to do that in KM.

Hey there, yes, that is doable. Simply assign two hotkey triggers, using the same key, one on key press and the other on key release. See screenshot for example.

Hotkeys Screenshot (click to expand/collapse)

Screenshot 2024-05-15 at 09.04.12

1 Like

Since the %TriggerBase% token doesn't tell you whether the trigger was the "Press" or the "Release," you could probably solve this effectively by doing the following:

You can use the full %Trigger% token, which ends with "pressed" or "released" as appropriate, eg:

The Hot Key F11 is released

Demo:

Trigger Test.kmmacros (3.0 KB)

1 Like

Wow! I learn something new every week. I feel bad, sorry.

1 Like

Don't feel bad! Aren't we all here to learn new things?

And I snuck a sneaky formatting option into the dialog -- I was thinking that the \U\l version might be useful in the "Autocorrect TWo..." thread...

2 Likes