Skip to content

Instantly share code, notes, and snippets.

@sydragos
Created May 11, 2023 17:48
Show Gist options
  • Save sydragos/2c1b458fd1edc65d882f077be3eaea89 to your computer and use it in GitHub Desktop.
Save sydragos/2c1b458fd1edc65d882f077be3eaea89 to your computer and use it in GitHub Desktop.
How to keep disabling Pixel Buds Pro input device on MacOS Ventura

Why:

  • having the input device "Pixel Buds Pro" lowers the audio quality significantly
  • MacOS constantly selects it instead of builtin microphone every time it connects
  • there seems to be a LOT of conflicting info on the interwebz on how to do it

Prerequisites: homebrew installed, including brew install SwitchAudioSource

Need 2 files, first create an AppleScript DisableAudioInput.scpt in your /Users// folder using Utilities\Script Editor.

-- Get the current audio input device
set inDevice to do shell script "/opt/homebrew/bin/SwitchAudioSource -c -t input"

-- Check if the current device is "Pixel Buds Pro"
if inDevice does not contain "MacBook Pro Microphone" then
	set currentDevice to do shell script "/opt/homebrew/bin/SwitchAudioSource -c"
	if currentDevice contains "Pixel Buds Pro" then
		-- Disable the "Pixel Buds Pro" audio input device
		do shell script "/opt/homebrew/bin/SwitchAudioSource -t input -s 'MacBook Pro Microphone'"
		
		do shell script "logger 'Audio input device (Pixel Buds Pro) disabled.'"
	end if
end if

Now create a 2nd file in ~/Library/LaunchAgents/com.example.disableaudioinput.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.example.disableaudioinput</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/bin/osascript</string>
        <string>/Users/your-username-here/DisableAudioInput.scpt</string>
    </array>
    <key>StartInterval</key>
    <integer>5</integer>
</dict>
</plist>

3rd and final step, run this command from terminal:

launchctl load ~/Library/LaunchAgents/com.example.disableaudioinput.plist

Done! Enjoy higher audio quality every single time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment