I'm wondering if there is a way – perhaps via Applescript – to assign a keyboard shortcut to raise the volume of the microphone by 10 e.g., and then the other way: another keyboard shortcut to lower the mic's volume by 10.

I found a script here that mutes and unmutes the mic:

if inputVolume = 0 then
    set inputVolume to 100
    set inputVolume to 0
end if
set volume input volume inputVolume

But I would like to just lower and raise the inputVolume, not completely mute and unmute. So basically what I need help with is that I don't know how to take the variable that is the volume and add or remove 10 from it. Help would be much appreciated! :)


You can increment the inputVolume variable in your code like this (change + to - to decrement):

set inputVolume to inputVolume + 10

Alternatively, you can use a single-line script to increment volume without having to assign a variable:

set volume input volume ((input volume of (get volume settings)) + 10)

To assign a keystroke, you can use Automator to create a Quick Action that appears in the Services menu and executes the one-liner above:

  1. Launch Automator from the Applications folder.
  2. Create a New Document and select Quick Action as the document type.
  3. In the "Workflow receives" dropdown, select "no input" in "any application".
  4. From the Actions list, find and double-click Run AppleScript.
  5. In the AppleScript window that appears on the right, replace the code that's there with the one-liner above.
  6. Save the quick action – I named mine "Increase Mic Volume", which now appears in the Services submenu of the application menu.
  7. From the Services menu, select Services Preferences.
  8. Find the entry for Increase Mic Volume and click "none" in the right column to assign a keyboard shortcut. Make sure you choose a unique key combination that's not likely to be in use by the apps you use.

Repeat the same steps for Decrease Mic Volume.

You can confirm it's working by opening the Sound preference pane in System Preferences and going to the Input tab, then watch what happens as you press your assigned keyboard shortcuts.

The Apple documentation for input volume is here.

  • Thank you very much, it works like a charm! – Solmyr87 Apr 21 '20 at 16:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.