Skip to content

Instantly share code, notes, and snippets.

@simonjodet
Last active December 11, 2018 00:09
Show Gist options
  • Save simonjodet/211fe010d842527c09d357724060282b to your computer and use it in GitHub Desktop.
Save simonjodet/211fe010d842527c09d357724060282b to your computer and use it in GitHub Desktop.
Quick audio interface switch for Mac OS
#!/bin/bash
CURRENTINTERFACE=`/usr/local/bin/SwitchAudioSource -c`
EXTERNALINTERFACE="FiiO USB DAC-E10"
if [ "$CURRENTINTERFACE" = "$EXTERNALINTERFACE" ]
then
/usr/local/bin/SwitchAudioSource -t output -s "Built-in Output"
/usr/local/bin/SwitchAudioSource -t system -s "Built-in Output"
else
/usr/local/bin/SwitchAudioSource -t output -s "$EXTERNALINTERFACE"
/usr/local/bin/SwitchAudioSource -t system -s "$EXTERNALINTERFACE"
fi
/usr/local/bin/notify "`/usr/local/bin/SwitchAudioSource -c`" "Current audio interface"
  1. Create a /usr/local/bin/audiointerfaceswitch.sh file with the content above. Change "FiiO USB DAC-E10" with the name of your interface. Run /usr/local/bin/SwitchAudioSource -a to get a list of the available interfaces on your system.
  2. With Automator.app, create an app
  3. Run the app to switch interfaces. Use a launcher or BetterTouchTool or a similar tool to map the app to a keyboard shortcut.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment