Hot on HuffPost Tech:

See More Stories
Free Switched iPhone app - try it now!
AOL Tech

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

autohotkey

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:

 #+a::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down}
ControlGet, isEnabled, Enabled,,&Set Default
if(!isEnabled)
{
ControlSend,SysListView321,{Down 2}
}
ControlClick,&Set Default
ControlClick,OK
WinWaitClose
SoundPlay, *-1
return

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 StumbleUpon.com

Tags: audio, autohotkey, windows

Comments

9