I haven’t worked on Bunch for a while because it was just doing everything I needed from it. But you know how it goes when you can’t sleep…
It’s been a while since I talked about it, so I’ll just real quick remind you that it’s an app that lets you use plain text files to launch batches of apps, and run Automator workflows, AppleScripts, and shell commands. Oh, and it can do things like toggle Do Not Disturb and Dark mode and change your desktop wallpaper. All sitting in your Dock or your menu bar and just a click away.
Anyway, a couple of days ago I needed to automate switching audio inputs and outputs and I thought Bunch should probably be able to do that. Thus began my first exploration into CoreAudio and some of the intricacies of macOS audio. Obviously my needs were fairly rudimentary, but I did learn a lot in the process.
The latest version now includes commands for switching audio inputs and outputs, and for setting volume. Bunch commands are surrounded by parenthesis, and are pretty flexible with spacing and such. All of the audio commands start with the word “audio”. If you use the following in your Bunch file, it will set the volume to 50%:
(audio volume 50)
That on its own is pretty lame, because you could always just send an AppleScript one-liner to do the same thing. But here’s where it’s a bit handier: you can switch your system input and output devices using partial name matching. Just use
(audio input DEVICE NAME) and
(audio output DEVICE NAME).
I have a bunch of audio devices on my system. My Scarlett Solo, my Alesis iO Hub, my Komplete Audio 6, plus the built in speakers and some Loopback devices. With this new feature, I can have the system default change when launching or quitting a bunch. As I was just saying a second ago, you can use partial names when referring to your devices; any unique portion of the name will find the right device, and it’s case insensitive. For example:
(audio input scarlett) (audio output macbook) (audio volume 0) !(audio input macbook) !(audio volume 80) !(audio output io hub)
That includes both “start” and “stop” commands; the “!” lines will only be run when quitting (or toggling off) a Bunch. So when I open this Bunch it sets my input to the Scarlett Solo and my output to the MacBook Pro Speakers, and then mutes the output. This is ideal for my podcasting setup, as my output from Skype is handled directly by the app and this prevents other audio (dings and whistles) from being heard. Then when I quit the Bunch, it toggles the volume back up to 80% and switches the output to my the iO Hub (which powers my studio monitors).
One caveat is that many external audio interfaces (like ALL of mine) don’t allow volume to be set by the system. So the volume command generally only operates when an internal source is selected. But I haven’t had any issues with the input/output commands on any of my devices, and just being able to mute the internal speakers when needed covers my bases. There’s room to flesh it out more, though, so if you have reasonable requests, let me know!
Just as a reminder, the project page is where I document all of Bunch’s features, and it serves as the only real help system for it. There’s enough there that I’m certain that — were you looking for something to do on a slow day — you could find new and cool things you didn’t even know Bunch did with just a little looking.
I think these tools are a useful addition to Bunch, and I’m already using them in all of my podcasting, music listening, video watching, and screencasting Bunches. Download link for the latest version is below.