Last active
September 29, 2024 00:29
-
-
Save mluisbrown/e5a89eeabd97c04083737b9261de5d75 to your computer and use it in GitHub Desktop.
AppleScript to set macOS audio input device to "Internal Microphone"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Sets your audio input source to "Internal Microphone" | |
-- Frequently needed if you use bluetooth headpohones and | |
-- run the Xcode iOS simulator, which will often set your | |
-- headphones to be the input device, resulting in a drastic | |
-- decrease in sound quality, and making it mono | |
tell application "System Preferences" to activate | |
tell application "System Preferences" | |
reveal anchor "input" of pane id "com.apple.preference.sound" | |
end tell | |
delay 0.5 | |
tell application "System Events" to tell process "System Preferences" | |
tell table 1 of scroll area 1 of tab group 1 of window 1 | |
select (row 1 where value of text field 2 is "Built-in") | |
end tell | |
end tell | |
quit application "System Preferences" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
install homebrew, set it to path, install switch audio source
terminal setup:
applescript:
do shell script "/opt/homebrew/bin/SwitchAudioSource -t input -s 'MacBook Air Microphone'"
The above is for a MacBook air, list your audio devices in terminal with the below code to get your input name:
SwitchAudioSource -t input -a