AppleScript for "Is _input_ muted?"

Apple’s AppleScript for get volume settings will tell you if the speaker (output) is muted:

output muted (a boolean)

but I’m trying to find out if the microphone (input) is muted.

I can use input volume of (get volume settings) to tell me the level that the mic is at, but not whether or not it is muted.

Googling didn’t turn up anything promising, but does anyone know if there is another way?

Can you explain what you mean when you refer to a microphone’s input being muted versus the input volume of the microphone being zero ?

Being muted and having the input volume to zero are not the same.

You can find many examples of people who want to mute their input (usually a mic) being told to set input volume to zero, but what ends up happening is that they can still be heard.

An Illustration…

Here is Rogue Amoeba’s SoundSource showing my current input and output levels:

Output (speakers) are at 25% and input (microphone) is set to 20%.

You can see that my “Input” is muted (red icon) but my output is not.

If I run the AppleScript command

get volume settings

it will come back with this:

{output volume:25, input volume:20, alert volume:100, output muted:false}

Same thing, except muting the output/speakers:

Now, if I mute my output, SoundSource will look like this:

Both the Input and Output are muted (red icon with small x) but they still show 20% and 25% respectively as their levels.

Now if I run the AppleScript command get volume settings it will come back with this:

{output volume:25, input volume:20, alert volume:100, output muted:true}

The only thing that changed is that muted:false changed to muted:true.

So, you can see that having the input and output muted does not set their volume to zero.

The output is still shown as 25% and the input at 20%.

AppleScript can tell me if my output is muted

I can run the AppleScript command

output muted of (get volume settings)

and get either true (is muted) or false (not muted).

Can AppleScript tell me if my input is muted?

If so, I’m not finding the correct syntax.

I tried

input muted of (get volume settings)

but this is the error that I get:

Script Editor says “A identifier can’t go after this identifier.”

Does anyone know a way to do this?

There doesn’t seem to be a way to do this with AppleScript/Shell scripting by themselves, out of the box. You would need some third party application.

There may be an ASObjc method.

But, since you have SoundSource installed you may try GUI scripting

tell application "System Events"
	tell process "SoundSource"
		activate
		get value of checkbox 1 of UI element 2 of window "SoundSource"
		-->1 = muted
		-->0 = unmuted

	end tell
end tell

1 Like

You can “mute” the system input from AppleScript with

set volume input volume -1

This shows up in SoundSource as mute and my Voice Memo test confirms this. Perhaps you can leverage this to ensure a mute? FWIW get volume settings still displays the input volume as zero.

Here is a probably fragile way to check the mute value using Audio Midi Setup:

tell application "Audio MIDI Setup"
	activate
end tell
tell application "System Events"
	tell process "Audio MIDI Setup"
		set MuteValue to value of checkbox 1 of UI element 4 of row 2 of outline 1 of scroll area 1 of tab group 1 of splitter group 1 of window "Audio Devices"
		-->1 = muted
		-->0 = unmuted
	end tell
end tell
2 Likes