0

I'm trying to write a script that detects a change in this setting: Setting in the red box

However, I'm having trouble locating the .plist file where this setting is stored. Does anyone where I can find this file?

Edit: I feel like it may be located at /Library/Preferences/Audio/com.apple.audio.DeviceSettings.plist however, I can't narrow down the numeric value that corresponds to input volume

3
  • You could copy the file, just the volume and run diff your-copy /Library/Preferences/Audio/com.apple.audio.DeviceSettings.plist to check for changes.
    – nohillside
    Apr 24, 2020 at 11:41
  • I did this but unfortunately, there didn't seem to be any immediate change after I adjusted the input volume. I think /Library/Preferences/Audio/com.apple.audio.DeviceSettings.plist may not be the location of where the input volume setting is stored. Apr 24, 2020 at 13:44
  • After further testing, the microphone input volume settings were actually in the .plist file I mentioned, however the numeric value corresponding to the input volume doesn't seem to update until after restart. Apr 25, 2020 at 10:44

2 Answers 2

1

I don't know in which file the value is stored, I haven't found any file change in your suggested file when I changed the input volume.

But you can access the value via Terminal and AppleScript:

osascript -e 'input volume of (get volume settings)'

This will get your input volume as a number between 0 and 100.

4
  • Thanks for your input. This sort of helps, but is there any way to continuously check for changes in the value from this command? I intend to trigger a bash script once the input volume changes value. To achieve this, I was originally thinking of using a .plist file in ~/Library/LaunchAgents in a similar way outlined here macissues.com/2015/02/02/… Apr 24, 2020 at 13:39
  • You could hack something together with the watch command. Watch regularly executes a command and with the -g flag, watch exists, if the command output differs. watch -g "osascript -e 'input volume of (get volume settings)'" && echo 'test' for example echos 'test', when your input volume has changed.
    – Tukan3
    Apr 26, 2020 at 0:51
  • Just to clarify, do I have to install something to get this command to work? When I input this command into terminal, it returns: bash: watch: command not found Apr 26, 2020 at 1:17
  • Yes sorry for not mentioning this, you can install watch for example with brew, this is a great way to install many other command utilities as well. To install brew in the first place, you can follow this explanation: brew.sh Afterwards you can install watch with brew install watch
    – Tukan3
    Apr 26, 2020 at 1:20
0

With additional testing, I have located the file where input volume is stored. It is actually in /Library/Preferences/Audio/com.apple.audio.DeviceSettings.plist as I suspected and the corresponding numeric value for input volume is under AppleHDAEngineInput > Controls > Item 2 > Value (as shown below).

enter image description here However, this value only seems to update after restarting the coreaudiod process with this command: sudo launchctl stop com.apple.audio.coreaudiod && sudo launchctl start com.apple.audio.coreaudiod. Any changes made to microphone input volume in System Preferences will not change the value found in the .plist file until the coreaudiod process has restarted. Editing this value does not seem to change the actual microphone input volume.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .