Skip to main content

Smart audio output switching

Use a wrapper around DWeller's amazing switchaudiosource, to use partial matching to switch to an audio source by typing part of it's name: out Speak switches to Macbook Pro Speakers.

I use the following script

#!/usr/bin/env bash
# Usage: ./out Speak
if [ "$#" -ne 1 ]; then
  switchaudiosource -a
  exit 1
fi

switchaudiosource -a | grep "$1" | xargs -I _ switchaudiosource -s "_"