Switching your Mac’s audio output device with a keyboard shortcut

Here’s a typical scenario:

I’m writing an article, and I’m listening to music on Spotify over a bluetooth speaker that’s connected to my MacBook Pro. Suddenly, both my iPhone and Mac start to chime1. I have an incoming phone call.

When the phone rings I need to to two things under duress: put my headphones on and switch the audio output from the bluetooth speaker to the headphones. And I need to do this all before the call goes to voicemail. Seems simple enough. But it’s tougher than it sounds.

I know there’s a fast way to switch audio devices by Option-clicking on the volume icon in the menu bar and then choosing the audio device from the dropdown menu, and this sounds easy enough. But those menu bar icons are pretty small and there’s something about mousing under pressure that shoots my aim to hell. So this shortcut just isn’t a solution for me.

If I could create a simple keyboard shortcut that let me switch between all of my audio devices, that would be the best solution. But the question is, can I quickly switch between audio devices with a keyboard shortcut?

Using an applescript to set the audio device on a Mac

After a little googling, I found a simple, short applescript here, edited it a little to suit my purposes, and assigned it a keyboard shortcut to switch between the three audio output devices.

The applescript goes into the system preferences and picks the output device you indicate from the list of devices currently available. I’m sure that, in more skilled hands, this could all be done from a single instance of the script, but I chose to use 3 different versions of the script, each one indicating one of the three audio devices that I want to switch between.

#!/usr/bin/osascript

tell application "System Preferences"

reveal anchor "output" of pane id "com.apple.preference.sound"

end tell

tell application "System Events" to tell process "System Preferences"

tell table 1 of scroll area 1 of tab group 1 of window 1

select (row 1 where value of text field 1 is "Name-of-thing")

end tell

end tell

quit application "System Preferences"

Just edit “Name-of-thing” to the name of the device as it appears in the Sound preference pane, run it, and it will set that device as the current one.

Creating an audio output switcher shortcut with Keyboard Maestro

Next, I needed to set up keyboard access to this script. There are a number of ways to do this, Automator, Better Touch Tool, and others, but I chose to use Keyboard Maestro because it’s very powerful, very flexible, and I already use it to manage dozens of my shortcuts.

To keep the shortcut memory overhead to a minimum, I assigned all three scripts the same keyboard shortcut. In Keyboard Maestro, this pops up a palette with each of the actions listed. Just type the number that corresponds with the action’s position in the list. To make this easier, I number each of the items in the list. I then assigned CMD, OPT, CTRL, Shift + S (for ‘sound’) to this palette.

Step-by-step

Here’s a quick step-by-step walk thru of creating an audio output switcher with Keyboard Maestro.

  1. In a text editor, edit the applescript included in this article. Replace “Name-of-thing” with the name of the device exactly as it appears in the Sound Preferences pane.
  2. Create a new group in Keyboard Maestro called Audio Switcher
  3. Create a new shortcut in this group. Name it “1. name of your device”. Using a numeral will make this item appear first in the list, and will be a helpful visual cue for what number to hit when you summon the palette.
  4. Click the New Trigger symbol and enter your desired hot key trigger
  5. Click the New Action Symbol and search for Execute Applescript in the list of actions
  6. Keep the default options for the new action.
  7. Paste the edited applescript into the script field.
  8. Test the script.

Repeat for each device you have. I recommend using the same hot key trigger and using the palette to reduce the number of shortcuts you need to keep track of.

Links

Easy Audio Output Toggle Using AppleScript, Growl and Quicksilver

Keyboard Maestro

  1. I use Continuity to make and take calls on my computer. Since my co-workers use a range of technologies for voice and visual communication, it’s incredibly convenient to use a single device, my Mac, for all of it. A single device, a single set of headphones with a mic.
Victory Conditions

Victory Conditions

Here’s my list of victory conditions, compiled from a number of sources, from my personal experiences, and my scientific determination of what will make me feel superior for as long as possible.

1. Write every day.

Of all of them, this one is the hardest to achieve. I’m a creature of habit. And when there are five days of the week that are relatively similar, what with work, and school and bathing, it’s easy to keep going. But the weekends roll around and everything is different.

No alarms, no real routine (at least with my family). And with the noise and interruptions. It’s just much more challenging to make happen.

Tough one.

2. A daily word count. Like 1000 words a day.

1000 words is a good starting point for beginners, according to Stephen King in his horrible book1On Writing.

3. But really, 2000 words a day.

2000 words a day is how many words you should write every day, if you really mean it. If you’re serious. According to Stephen King. He said it in that same hated book.

4. Write a story a week for a year.

Who was it? Ray Bradbury or someone? Anyway, some successful writer said that when you’re just starting out don’t dig right into a novel. You don’t learn enough from a novel. It takes too long. Try to write a story a week.

Find your voice.  Write shitty stories.  Just write 52 of them. One a week. I think he said that no one can possibly write 52 bad stories in a row. I’m setting out to prove him wrong.

5. Write a post a week for a year

I have trouble with articles. So I’m trying to get better. And why not just copy the notion of writing a post a week? 52 posts. That’s not bad. Work out the process of having ideas and then attempting to articulate them into an article.

So those are my victory conditions. Some challenging, some easy, all do-able on my schedule. I can get at least one of them a day, and up to three, and I get another two every week.

So it’s a start. Maybe I’ll add more later.

Let’s see if it works:

Last week, I wrote a story. And I wrote a blog post. I’m two days into my next story. And yesterday I wrote…checking the numberrrr…here it is:

2212 words.

I’m feeling something…yes…yes, the warm glow of smug superiority.

Success!


  1. I hate On Writing by Stephen King. I did read it, and I got some good things out of it, but I don’t like some of the messages it sends about the process of writing. I’ve been trying to put my anger into words for some time now and haven’t succeeded.

Cheating for the win

To review, I quit writing a novel.

I quit because it was broken, and I didn’t know how to fix it. I’m not good enough to make it into the story that I want it to be. So, I need to become a better writer. I need to become a better writer by writing more. More words, more stories, more articles, more stuff.

But…why? There’s no real end goal with being a successful writer. Yeah, money, fame and all that. But really the reward for being a successful writer is that you get to write more. And then, when you’re done, you get to celebrate by starting to write a new thing. It’s a hamster wheel. So there’s no castle at the end with a princess in it. There’s no ceremony, no podium to stand on, no award that means you won writing. You can’t win writing. You just get to keep doing it. And that’s your reward. Ideally, you get to do it until you die.

And this should be a good thing. Right?

Endlessly doing something? Until you die?

This is good?

Yes. This is good.

Sometimes, your weak human mind will have a flash of clarity and tell you that everybody dies, and you could die tomorrow, and why should you spend all your life sitting at a computer waggling your fingers when you should be out in the sunshine! You should be watching TV! You should be playing that new game, or having drinks with your friends, or shopping, or doing whatever that isn’t writing. Because life! It’s for living! Yeah! Cue Mountain Dew commercial! No, no. You’ve got to learn to tamp that zest down. It will only make you do fun things that you will probably enjoy. Unacceptable!

The key, I’m discovering, is to train your mind to take pleasure in work. Fun and enjoyment? Nah. The real challenge is to learn to derive self-worth from doing things that make you feel shitty about yourself for long stretches of time. If you can do that? Then, my friend, you’ve got an endless supply of confidence.

I’m going to rig the game.

So how am I going to do that? How will I ever train myself to take pleasure in thankless, futile labor locked in the damp and fetid chambers of my own mind? Easy. Cheat. Rig the game so that I CAN win. I’m going to win all the time. Like every day. Like every week. Because who doesn’t like to win? People will do anything to win. Right?

Here it is: I need to fool myself into working when I don’t want to work. Maybe what making it easy to win will do is get me that little rush of accomplishment.

That same feeling you get when you manage to get up one morning and you exercise and spend the rest of the day strutting around the office, feeling superior. That little smirk on your face. That wonderful smug feeling. We’ve all felt it.

I think I’ll need it every day. Every hour sometimes. So I need set up many ways for me to win. Many ways for me to get that feeling whenever I need it to get going. I need victory conditions.

By the way? I wrote 2324 words yesterday.

So.

I’m better than you.

Ahh. That’s the stuff.

52 for strength

My novel died in February of 2014. It died because I wasn’t good enough to save it.

I spent a long time with one set of characters, with one set of situations and one, albeit large, plot.
Writing is like exercise, they say.

So writing my novel was like I just got on the bicep machine and worked a bicep. It’s big. 200k words. So that’s good. I learned a lot, too. I don’t regret it. I learned how to write every day, and what it felt like to write 2000 words. How to be committed, and how to trick myself into thinking that it’s actually fun to write.

But it was time that I recognize that I’m all bicep and no core.

I got lots of valuable stuff out of the experience, but what I didn’t get to do was practice. Practice writing different types of characters, scenarios, settings, moods, themes, etc. The core muscles, to continue with the exercise thing.

So how does one go about building up that core of writer strength?

I’ve taken writing classes and seminars. I’ve read books on writing. I’ve watched videos. I have writing software (Scrivener). I’ve got a great keyboard, the best computer, and time and space that I can use to write. But none of these things make a good writer.

Only writing does that. Writing lots of stuff. All the time.

This is where a quote from Ray Bradbury comes in.

“Write a short story a week. It’s not possible to write 52 bad stories in a row.”

I like those odds.

So, in early February, with my novel wheezing it’s final breaths on the screen before me, I started thinking about my story a week project, or 52 for Strength.

I did a little googling for some help with strategy and for any info that might come in handy to know before setting out on a big long journey like this one, and I found a pretty good guide.

Something published by writer Jay Lake. It’s just a six-page PDF called Jay’s Guidelines for Writing Fiction outlining his writing process. But it was exactly what I needed.

It’s just a few simple rules to stick to:

  1. Write a story every week.
  2. Finish everything you start.
  3. Don’t self-critique while you’re writing.
  4. Work on one thing at a time.

I like it. Simple. Common sense. Nothing too elaborate. He goes on to flesh these things out, and it just made sense to me. So I’m doing it. Now there’s just one thing missing…

The stories.

Where does one get 52 story ideas?

A novel breakup

So, that novel I was working on? Yeah. We broke up last month.

We were together for two years. Two years is a long time. But when it’s not working, it’s not working.

No, no. It was good. A good break-up. Mutual.

It told me that I had problems, and that I need to work on them. And it’s right about that. But it also recognized that it had its own issues to work out. And to do that, we both need space. Time apart.

So I’m moving on. You know. Doing stuff. Keeping busy. Reading.

And I’m still writing. Seeing other stories, carving more notches on the literary bedpost.

But I’m good. I’m good. Really good, in fact. Like a weight has been lifted. And the best part is that I’ll get better because of it. I mean, the experience, the pain, the time lost. The failure. But also because of what comes after. Letting go. Moving on to the next one.

And then the next one.

Wordnik.com is better than the dictionary.

I just found out about this site called Wordnik, and it is now the place that I will go to find my words, to define my words, and to learn new words.

Stick your word in the search field and Wordnik will go to work for you.

It'll give you the definision of a word from several different online dictionaries and encyclopedias and other collections of lexcical1 information.

Hyponyms? Hypernyms? Wha??

Some of these things I did't know what they were, but now that I know about them, hell yes I want them in my fricking dictionary! Why weren't they there before?

Synonyms, hyponyms, hypernyms, rhymes. Words that are found in similar contexts. Examples of the word in use. All very useful to have available when doing some serious word work.

And a great resource, the Reverse Dictionary which I used to look up what the study of insects in order to distiguish between Entymology and Etymology, the study of the history of words. Two words I confuse often.

This is now the place that I go to find my words. Incredible free resource.


Wordnik via some link blog that I can't remember now.

  1. A word that I had to look up to make sure it actually existed and meant what I thought it meant.

Getting to 1000 words a day

There are flapping hoards of articles out there circling the internet with clever headlines that get your attention promising they know the tricks and tweaks to help writers learn about how to write.

First of all, writing is the wrong word for it.

To me, writing is a generic term, an all-encompassing term for putting ideas on a page and making them work nicely together to tell an engaging story. I believe that there are at least three other stages of writing that come before and after the drafting stage. And to me, it simply makes sense to me to divide these things up. My mind is like a martini glass, very shallow. Start dumping too many ideas in there at once, and they start splashing around, sloshing up and over the rim, dampening onlookers and passersby.

So when you hear about writers setting a word count for the day, I say what they’re really talking about is the drafting stage of writing. I consider drafting to be the part that consists of barfing words my keyboard. The end goal of this stage is to produce a draft, a rendition of the story being written that ranges in quality from crappy to outrageously feculent.

But I’ve found out in the last year of drafting my first novel1 is that the act of drafting is about two things:

  1. Getting there
  2. Staying there

Start with Getting There

Getting there is about the habit. Making the proverbial writing desk the only place to be at a certain time of day. And making it an action that does not require input from the brain at all. If the brain was consulted in this matter, it would recognize just how hard the work actually is and then resist, throwing up reasons not to be at the desk, reasons to be just about anywhere else. So it’s the body’s job. The body has to get itself there.

Find your special time

My special time of day comes at 5:45am. And is it not ideal. Not by a damn sight. And, between you and me, I only make it 80 or 85% of the time.  But, thing is, it’s the only time that I can consistently carve out quiet time to put two thoughts together. So I make it work.

The problem with getting there is that it’s never the easiest thing to do. My personal list of distractions is full of stuff that would be more fun to do than get up at 5:45 in the morning. Sleeping chief among them.

It will never be “fun”

They say that if forced to think about what to do from minute to minute, the first tendency for a human being (and maybe the second and fifth and twelfth) is to do the easiest, tastiest, and most immediately gratifying thing on the list and then spend the rest of the day on the couch groaning and rubbing his or her belly. Or his or her other parts.

It may be best to realize now that there’s always going to be something else that at any given moment sounds better or easier than sitting in front a half-done, terribly written, soul-drain of a manuscript.

So the big take-away here is that it is never going to be fun to sit down and write. Never. Ever. Never-ever.

Well, okay. It might be fun the first couple of times, or maybe when things flow and the mind hasn’t had time to realize just what unnatural acts are being performed with it. But that period ends quickly. And soon, it will begin to hurt.

Gotta want it

It is very important that it’s been determined that writing is what you really really want to be doing. Sometimes it’s hard to make that determination.

It helps to have a life that’s full to the gills and rife with things pulling at your attention. It clearly delineates what merits attention, and it becomes quite clear what things precious time is spent doing.

I’ve carved an awful lot of fat out of my life since having kids. And I’ve never been more prolific. And that goes for more than just writing. I get more stuff done now, when I have so very much less free time than ever before. The benefits of focus.

I’ve already said it, but here it is again: There will always be something more fun to do than sit down in a bad chair and attempt to wring brilliant ideas out of an unwilling brain, But all is not lost. For the brain is stupid. And gullible. And easily tricked by things like puppies, high-fructose corn syrup, and porn.

Mine especially.

But yours especially.

It’s about reducing friction

For a writer (or any maker of things), friction, or resistance as it’s sometimes called, is one of the fundamental interactions of nature, akin to electromagnetism and gravitation.

This friction is the irrational desire to watch Star Trek: The Next Generation fighting against the tiny squeaking voice chirping some nonsense about doing something that would instill a sense of pride or self-worth. Like, I don’t know, writing a novel?

And while friction is forever, like the tides, it is possible to lube up and fight it off for awhile. It can be overcome. With the proper amount of scientifically applied mind-jiggery.

It’s about forethought. Planning. Thinking ahead. Greasing the skids. Okay? It’s what sets us apart from the animals.  We can think ahead.  Try it.

What’s the best lube?

Set an alarm. When that alarm goes off, that’s the time when all else is set aside, the computer is turned on, and writing is done.

If there is a period of time during the day in which there is a predictable lull, pull out the laptop or the notebook, or the iPad and start to work.

If there is a time of day in which time is being regularly wasted, insert pen and paper.

Do this every day. Make it a habit. Make it something that does not require thought. Remove the possibility of doing anything other than write so that it is not a job that’s up to the part of the mind that is easily distracted by a Diet Coke or babies. It’s simply something that a body does when a certain bell is rung.

Then just sit down. And then write. This is the first step toward getting 1000 words in a day.

Just get there.


The War of Art


  1. Which clearly makes me an expert, yes? ↩

Danny Boyle On The Ruination of Mature-Themed Film

Danny Boyle, director a few movies you might have heard of, speaks out about the ‘Pixarification’ of film, by which me means the loss of mature-themed, adult-oriented movies.

He makes a few really good points about the use of violence in the stories, but beyond that, I’m not sure that it’s a trend that warrants the concern he’s voicing.

He’s worried that real adult oriented filmmaking / storytelling is moving to TV from the cinema.

I wonder why that’s a bad thing. Things change. And I’d say that a complex story with adult themes in them works better in a more spacious medium like television. More time spent with characters, more time available to explore nuance and subtleties.


Via Geek Tyrant

Danny Boyle on IMDB

Trainspotting

Slumdog Millionaire

28 Days Later

Oak Outliner

I do a lot of thinking in outlines, and I’ve used quite a few outliner apps in my time as a computer user and thinker of things.

My favorite for ease of use is OmniOutliner. I can just fill up line after line in that app. But the problem occurs when it’s time to get those lines out of the app. There’s no smooth way to get them out. Not that I’ve found.

There’s the OPML export, there’s the copy and paste, there’s dragging them from the app into the window of another app, but time and time again, I run into the same problem that I can’t get the stuff out of that outline without having to go back and be on the hook for a lot of fiddly clean up of odd carriage returns and spacing, extra characters that show up in export because I forgot to turn off the checkbox feature. Things like that.

It’s possible to get the stuff out, but the cost of cleaning it up outweighs the savings in using the app over using a text file or doing it right in a word processor.

Oak Outliner is weird in that it is a web-based application1 that stores your outline in the browser’s cache. That means it stays where it is, no syncing, no saving. Lots of neat features like intuitive keyboard shorties and folding of lines.

I think it’s pretty slick, just like I think another project made by these guys, Folding Text is chock full of interesting potential. And maybe for a quick one-off brainstorming session Oak Outliner might be really handy. But I’m struggling to think of a reason why I’d use this over a text editor, or Scrivener, or a native app.

I will be keeping an eye on this though.


Oak Outliner

Folding Text

OmniOutliner


  1. There are tons of these things popping up now. Checkvist, Fargo along with Oak are the newest and fanciest, I think.  ↩