Hot on HuffPost Tech:

See More Stories
Engadget for the iPhone: download the app now
AOL Tech

Windows 7 Tip: How to change the default audio device with a hotkey


Windows Vista and 7 have a new audio subsystem, with lots of neat features. It is not, however, without its quirks. One such quirk is the inability to automatically change the default audio device; you must do it manually.

This means that if you have both headphones and speakers plugged into your computer, whenever you want to pipe all sound through the headphones you must right-click the volume icon, select Playback devices, go to the device you wish to set as default, right-click it, and select Set as Default Device. Sounds like fun, right? Now try doing this 5-6 times a day.

Incredibly enough, I could find no command-line utilities to automate this simple operation. I thought I might build something myself, so I started digging deeper. It turns out Microsoft seems to have done this by design; they wanted to prevent programs from changing the default audio device on users, because this can lead to a very bad experience (imagine a game which suddenly changes the audio to the speakers, when you wanted to listen to it using your earbuds).

I did try a couple of utilities which claimed to do this, but they were really bad. At this point, I did what I do every time the going gets rough: I turned to AutoHotkey. This amazing free automation program has a solution for just about anything, and indeed, AHK user Veabers already created the exact script I wanted in 14 elegant lines of code. This script toggles between two audio devices in about half a second on my system. Just hit Win+Shift+A, and you switch to the other device. Here's the whole thing:

Run, mmsys.cpl
ControlGet, isEnabled, Enabled,,&Set Default
ControlSend,SysListView321,{Down 2}
ControlClick,&Set Default
SoundPlay, *-1

Voila! The only thing I changed was the default key-binding, because the author's default did not work for me.

Share submit to reddit

Tags: audio, autohotkey, windows