If you’re like me, then you have both speakers and headphones. Speakers are the primary of course, but when I want to block out the world, I use the headphones to zone in. I think it’s a little too cumbersome to go into the
Sound applet > Playback Devices
to change my default sound device every time I want to switch.
So with the combination of a few different sources, I’ve come up with a great way to quickly toggle your default sound device.
The first step is to get nircmd -- this is a free tool from NirSoft. Download and save it to your %windir%\system32
folder. This is typically your c:\windows\system32
folder.
The second step is to get AutoHotKey. Download and install that. This software is what allows you to create new and custom hotkeys. I use it for a lot more than just changing my default sound playback device.
Then install this script below. I have it saved to My Documents. I also have a shortcut of this script in my startup folder so that the script is waiting and listening once I log in.
Here’s the script:
Using the hotkey Win+A, this will change your default playback device in Windows.
You will need to download and save nircmd to your c:\windows\system32 folder.
Change the “Speakers” and the “Headphones” names to those that match your Playback device names.
More information is here: http://obrienlabs.net/use-autohotkey-to-toggle-default-sound-device/
Now all you need to do is find the name of your playback devices and substitute “Speakers” and “Headphones” for the 2 devices you want to switch between. To do that, right click on the Speaker icon in your system tray (down by the clock), select Playback devices, and you’ll see the device name in that window.
Launch or reload the AutoHotKey script. When you press Win+A, you should see a little popup box in the lower right corner of your screen telling you which playback device is the active one.
I chose Win+A because it was an available Win logo key hotkey combo, and the A was a good match for Audio. Feel free to change or modify the hotkey as you see fit. Here’s the full list of AutoHotKey combinations you can use (e.g. CTRL+Shift+A is ^+a::
.)
My quick list of hotkey modifier symbols used to define a hotkey in AutoHotKey.
Full information at: http://ahkscript.org/docs/Hotkeys.htm
Hope this helped!
Thanks, this worked well for me. A small footnote: if you have more than one device named “speakers” or “headphones” you will want to rename the two you want to swap between to names that are unique in order for the script to behave. I have a lot of output devices.
It doesn’t work for me… it gives an error at the first line that nircmd come in
What is the error? Is nircmd in your system32 folder? Can you open a command prompt (start > run > cmd) and manually type it in and see what it does? Remember, you need to find what the name of the Playback device is. For example:
nircmd setdefaultsounddevice "Speakers"
I’m sure I’m too late here, but changing nircmd to nircmd.exe fixed it for me.
Good catch, glad it helped! 🙂
Thanks, Pat. Works a treat, as our friends across the pond say.
Richard
Glad to hear it!
Works flawlessly. Thank you for this.
Awesome, thanks for sharing this.
Many thanks been looking for something like this for ages worked first time bye Paul.
Thanks!
I’m having a little problem, it changes the default playback device normally, but don’t change the communication device, anyone knows any workarounds?
This is awesome! Exactly what I was looking for. SoundSwitch is giving me all sorts of problems with my audio interface (Focusrite Scarlett Solo) and AudioSwitch wouldn’t even install. Was prepared to build what you posted from scratch. Thank you so much!
I am having the same “problem” as Gabriel though. My Default Communications Device doesn’t change when the Default Playback Device changes. It’s not really a problem for me though, as I don’t think I use any programs that utilize the Default Communications Device. Just thought I’d make a note of it. Thanks again!
Hey i have a little more specific question but i think this solution in addition of some changes would totally fulfill my requests.
I thought about using this hotkey script to switch between my audio devices when i want to play counter strike : go. My question to this point is if there is a solution to define a hotkey which switches the audio devices first and afterwards just launches counter strike and maybe another hotkey which turns back to the “default” device after is just closed the game? i am not into autohotkeyscript that much by now. Some Help would be nice.
greetings