Six Colors
Six Colors

by Jason Snell & Dan Moren

This Week's Sponsor

Magic Lasso Adblock: 2.0x faster web browsing in Safari

By Jason Snell

SoundSource 5.5 adds Shortcuts support for full Mac audio automation

On Monday Rogue Amoeba released SoundSource 5.5, the latest version of its handy Mac sound-routing utility that—let’s be honest—is doing all the heavy lifting for a feature that should probably be a core part of macOS. (Apple doesn’t seem to really care about Mac audio, and that’s good for Rogue Amoeba’s array of products.)

The big feature of SoundSource 5.5 is support for Shortcuts. While Rogue Amoeba’s utility Audio Hijack decided to primarily support automation via JavaScript with some basic Shortcuts hooks, SoundSource is all in on Shortcuts. The app provides 17 different actions, and they affect not just SoundSource’s individual control over apps and audio inputs, but the system’s as well. So with SoundSource, you can now automate many of your Mac’s default audio settings, setting a new default input and output, for example.

As you might expect, I immediately dove into SoundSource’s new automation tools. Most of the time, I listen to music on AirPlay speakers and most system audio goes through my Apple Studio Display’s speakers. But when I’m writing, I often prefer to pop in my headphones and get focused.

That process takes several steps. I have to click on the AirPlay icon in the Music app, so that the audio stops using AirPlay. Once the audio is coming out of the Studio Display, I need to use the Sound preference pane to redirect the audio to my Mac Studio’s headphone jack—or use SoundSource to intercept Music and send it to the headphone jack.

But thanks to SoundSource 5.5, I’ve created a shortcut that automatically toggles between those two states, and assigned it to a Stream Deck button. Here’s how it works:

part of a shortcut, accessible version in shared shortcut above

Using a new SoundSource action, I’m detecting where the app is currently routing audio for the Music app. I’m using this data point to determine whether I’m toggling my intense headphone-listening settings on or off. If the Music app is set to External Headphones, the shortcut knows I’m listening there, and so the shortcut will use an If block to set the audio input back to my AirPlay speakers.

The first two steps are straightforward: For customizability, I’ve added a text block with the name of the AirPlay speakers I’ll be using. Then the shortcut uses SoundSource’s Set Source Device block to set Music back to its default state (outputting through the default audio device), and then—mostly to prevent some blaring audio artifacts during the switchover—waits for a second before executing an AppleScript script.

That script is hairy, because getting Music to change AirPlay sources via scripting is hairy. (Note to Rogue Amoeba: If Apple won’t make this more easily automated, maybe you could?) I found a solution to the problem in this Mac OS X Hints Entry from 2013 by iTunes/Music scripter extraordinaire Doug Adams, and adapted it to my needs. (Doug’s script asks you to pick an AirPlay source, so I omitted that portion.)

part of a shortcut, accessible version in shared shortcut

The Otherwise portion of the shortcut basically does the reverse action in the toggle—it uses another copy of that AppleScript script to set the AirPlay target to my computer, then uses SoundSource’s Set Source Volume and Set Source Device to get Music playing in my headphones at an appropriate volume.

Pretty easy, other than having to dig up a good way to change the AirPlay targets in Music. (Thanks, Doug.) And now I’ve got a button to press to do a bunch of dumb tasks that I used to have to do myself. This was the biggest itch I wanted to scratch with this SoundSource 5.5, but I’m sure plenty more will present themselves. Now that I can automate all my Macs inputs, outputs, and individual app audio routing, the power’s in my hands—and my shortcuts.

If you appreciate articles like this one, support us by becoming a Six Colors subscriber. Subscribers get access to an exclusive podcast, members-only stories, and a special community.


Search Six Colors