MacOS – way to set microphone input volume level if a change is detected in input volume level

audiomacosmicrophonesound-volume

When I'm on a Microsoft Teams call, the in-built microphone input volume level always automatically adjusts to 100%, which is way too loud for other people. There doesn't seem to be any setting I can change to prevent this within Microsoft Teams, so I'm looking for a way to set the microphone input volume level to 50% automatically when a change in input volume level is detected.

Right now, every time the input volume adjusts, I manually type in osascript -e "set volume input volume 50" into terminal, so is there a way to trigger this command when input volume changes? (Preferably without third-party software)

Best Answer

You can bind both output volume & input volume in one script that can be accessed via Script Editor.app > preferences > show app icon in menu bar.

tell application "System Events"
    set volume 2 -- this can be from 0-7
    set volume input volume 50
end tell