Disable/Enable microphone with keyboard shortcut

Hi,

it would be nice, when it is possible to enable/disable the microphone with BTT.

Thanks

The easiest way would be to have the keyboard shortcut execute an Apple Script ... to mute, you will do a

set volume input volume 0

Of course, if you want it to be smarter, you will want to save the previous volume level first so that when you 'enable' the mic, it will set the input volume back to the previous volume level.

If you use the "Run Apple Script" action you can also use a script that checks whether the volume is already 0 and by doing that toggles between muted and unmuted:

set MicLevel to input volume of ( get volume settings )
if MicLevel is 0 then
set volume input volume 100
else
set volume input volume 0
end if

Hi, thats very nice. Is it in any way possible to show an icon for example in the menu bar, which indicates the current status of the input? That would be fantastic.

Copy this json (cmd+c) into the "automations & named & other triggers" (cmd+v) section in BTT. Unfortunately this requires the latest alpha version 3.9998, because I just discovered & fixed a bug when I tested this.

[
  {
    "BTTGestureNotes" : "Mic Status",
    "BTTTriggerType" : 680,
    "BTTTriggerTypeDescription" : "Menubar Item: Mic Status",
    "BTTTriggerClass" : "BTTTriggerTypeOtherTriggers",
    "BTTPredefinedActionType" : 195,
    "BTTPredefinedActionName" : "Run Apple Script (async in background)",
    "BTTGenericActionConfig" : "set MicLevel to input volume of ( get volume settings )\nif MicLevel is 0 then\nset volume input volume 100\n\treturn \"active\"\nelse\nset volume input volume 0\n\treturn \"muted\"\nend if",
    "BTTInlineAppleScript" : "set MicLevel to input volume of ( get volume settings )\nif MicLevel is 0 then\nset volume input volume 100\n\treturn \"active\"\nelse\nset volume input volume 0\n\treturn \"muted\"\nend if",
    "BTTEnabled2" : 1,
    "BTTAlternateModifierKeys" : 0,
    "BTTRepeatDelay" : 0,
    "BTTUUID" : "C1AAB752-018D-47C2-8465-56AC8EE701C1",
    "BTTNotesInsteadOfDescription" : 0,
    "BTTEnabled" : 1,
    "BTTModifierMode" : 0,
    "BTTOrder" : 3,
    "BTTDisplayOrder" : 0,
    "BTTTriggerConfig" : {
      "BTTScriptType" : 0,
      "BTTTouchBarButtonLineHeight" : 0,
      "BTTTouchBarItemIconWidth" : 22,
      "BTTTouchBarButtonTextAlignment" : 0,
      "BTTTouchBarItemSFSymbolDefaultIcon" : "mic",
      "BTTTouchBarButtonTopMargin" : 0,
      "BTTTouchBarButtonFontSize" : 15,
      "BTTTouchBarButtonColor" : "110.000001, 193.000004, 56.000000, 255.000000",
      "BTTTouchBarColorRegex" : "muted",
      "BTTTouchBarAppleScriptString" : "set MicLevel to input volume of ( get volume settings )\nif MicLevel is 0 then\n\treturn \"muted\"\nelse\n\treturn \"active\"\nend if",
      "BTTTouchBarAppleScriptStringRunOnInit" : true,
      "BTTTouchBarAlternateBackgroundColor" : "255.000000, 45.000001, 33.000002, 255.000000",
      "BTTTouchBarItemSFSymbolAlternateIcon" : "mic.slash",
      "BTTTouchBarScriptUpdateInterval" : 5,
      "BTTTouchBarAppleScriptUsePath" : 0,
      "BTTTouchBarOnlyShowIcon" : true,
      "BTTTouchBarItemIconType" : 2,
      "BTTTouchBarItemIconHeight" : 22,
      "BTTTouchBarButtonBaselineOffset" : 0
    }
  }
]
1 Like

Wow, that was fast and is very awesome. Thank you very much. Maybe it is possible to include this as a new feature including the icon display in one of the next major releases.