Standard Windows switching between active audio devices methods are inconvenient. You need to open “Playback Devices”, select an audio device from the list and make it as default or you can also switch the device in the volume mixer window.
I switch back and forth between my headphones and computer speakers at work a lot. So I decided it was time to figure out a hotkey to do this. My coworker told me about a program called AutoHotkey, and combined with a small file it does everything I want it to. In this example below I am using F6 to switch to my computers and F7 to switch to my Logitech headphones. Also, I am running Windows 7 x64. The following tutorial should work fine on Windows 7 x32 and Windows 7 x64.
Audio Devices Hotkey
Step 1
Download and install AutoHotkey.
Step 2
During the installation, there is a x32 and x64 bit version. In this example, I am using the x64 bit version. The x32 should work fine as well. The new few screens just accept the default and click Next.
Step 3
Before launching the program you will need to create AutoHotkey.ahk. You can copy the contents of the .ahk file below:
[vb]
*F6::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 4}
ControlClick,&Set Default
ControlClick,OK
return
*F7::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 3}
ControlClick,&Set Default
ControlClick,OK
return
[/vb]
Step 4
Now you need to find what order your audio devices are in. On the bottom right of your taskbar, right click on the speaker icon and click “Playback devices.”
Step 5
You need to make a note of which order they are in before we go edit the AutoHotkey.ahk file. Notice that in my example, my computer speakers are 3 down from the top and my Logitech headphones are 4 down from the top.
Step 6
Now go and open the AutoHotkey.ahk file, that is in your My Documents folder, with Notepad. You will notice I set the down number in the file to match the order of my audio device. Also, you can change the function key to something else if you like.
Step 7
Now launch AutoHotkey from your program files, and it will run on your taskbar.
Step 8
I recommend reloading the script. Right click on AutoHotKey running in your taskbar and select “Reload this script.”
Now you can test your hotkey by pressing your function keys. If you have everything setup correctly this will now toggle between your audio devices with one press of a button! :)
How to Switch Between Audio Devices in Windows 10?
To switch between audio devices in Windows 10, you can use a newer and simpler program – Audio Switcher. It’s a freeware app for audio devices, focused on the speed and ease of use. It supports both types of audio devices – playback and recording.
Download Audio Switcher from the official site. After the download is complete, open the zip archive and extract the single AudioSwitcher.exe file to a convenient location. Installation completed!
Run the executable file. The program icon will appear in the system tray. Click on the icon with the right mouse button, select Open Preferences and setup some settings.
We recommend you to tick the Start when Windows starts option. This function allows the program to automatically start when you log on to Windows. To always display the icon of the active device in the tray, check Show Default Playback Device icon in tray. Select Start minimized so that the program does not unfold at startup.
When you have finished configuration, open the Playback tab and specify which device will work by default. Now you can switch between headphones and speakers in just two clicks:
- Right-click on the Audio Switcher icon in the notification area
- Select the desired playback device from the pop-up list.
Audio Switcher supports the use of hot keys. Each device can be assigned its own combination or select the general one to switch between them. To assign a hotkey, just right-click the desired device and select Set Hot Key. In new window you need to specify the hotkey that you want to assign to this device.
- Using Nslookup in Windows to List DNS Servers and Records - May 11, 2022
- Fix: Windows 10 Keyboard not Working - May 11, 2022
- How to Fix Gmail Not Updating on iPhone? - May 3, 2022
Thanks this was exactly what I was looking for. I have a 3 screen set up. 2 monitors on my desk and a HD TV. The main computer monitor and HD TV are clones using an HDMI splitter. I use the TV when I’m laying on the couch or watching youtube/movies from the computer. It was a pain having to always go into sound options and switch form computer speakers and TV speakers constantly. Now all I do is hit a button and it’s done! Tip for others: After you change the code be sure to right click the program and select reload script! :D
Thanks! Yes, I have been using this non-stop at work to switch between my primary speakers and headphones :) Actually saves a lot of time if you add up all the times you have to switch. I edited the post and added the ‘reload script’ part. I forgot to do that :) Thanks.
Hi for some reason this script only opens the sound device selection window. when i press either hotkey. i followed all steps i only have 2 sound devices so i set it to 1 and 2. what is wrong?
also is there a way to set 1 toggle key instead of two hotkeys?
OK figured it out.. after poking around a bit. i had to change
WinWait,Sound to WinWait,Ljud
and
ControlClick,&Set Default to ControlClick,&Standard
which it is int swedish version of windows.
but a toggle would still be nice :)
Tack för hjälpen där, Hannes! Nu fungerar det!
Your very welcome… seeing from Google translator… I’m assuming you said the following?? “Thanks for the help there, Hannes! Now it works!”
How can I modify this to change the default recording device?
*F8::
Run, mmsys.cpl
WinWait,Sound
Send {TAB 3}{RIGHT}
ControlSend,SysListView321,{Down 1}
ControlClick,&Set Default
ControlClick,OK
return
Follow the directions in the original how-to to change the hotkey and determine your recording device number.
Protip: Change playback and recording devices in one swoop
*F6::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 3}
ControlClick,&Set Default
ControlClick,OK
Run, mmsys.cpl
WinWait,Sound
Send {TAB 3}{RIGHT}
ControlSend,SysListView321,{Down 1}
ControlClick,&Set Default
ControlClick,OK
return
*F7::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 2}
ControlClick,&Set Default
ControlClick,OK
Run, mmsys.cpl
WinWait,Sound
Send {TAB 3}{RIGHT}
ControlSend,SysListView321,{Down 2}
ControlClick,&Set Default
ControlClick,OK
return
I used this to disable/enable my mic, but you can modify to change your default recording device:
#z::
Run, mmsys.cpl
WinWaitActive,Sound ; Wait for window to appear
Control,TabRight, 1, SysTabControl321 ; Select second tab
Sleep 10 ; Wait for tab, modify as needed
ControlSend,SysListView321, {Down 1} ; In the list of devices, select the mic to disable
Send {Shift}+{f10} ; Right-click
Sleep, 20 ; Wait for menu, modify as needed
SendPlay {Down} ; Arrow down to Disable/Enable
Send {Enter} ; Select
;ControlClick OK ; Exit
Hope it helps,
Great comment, thanks for the tip!
Like Hannes already found out, the script as it is here only works for english versions of windows.
So for everyone who hadn’t figured it out form the post, the hints for how to make this work for any language version of windows are in the script.
1; after WinWait, the word should be the same as the name of your audio panel(on top it says the name: Sound in English, Ljud in Swedish and in my case, Geluid in Dutch)
2; after ControlClick, the text should be the same as the center button on the audio panel, the one to set the dafault ( Set Default in English, Standard in English, Als standaard instellen in Dutch)
This should get you to figure it out in any language, and remember to pay attention to capitals.
just wanna say thanks!! this is really gonna make switching sound devices easier
Great Stuff, after some enhancements from Hannes June 15 it’s working perfect!
Also I agree with Hannes – to toggle the source would be really nice ;-)
..got no Idea how to do this (to toggle sources) ?!
Many thanks, just what wanted works a treat.
It is working fine, but my sound device is keep changing one to another automatically so when i open windows media player sound is discontinued in second interval. Try disabling the second digital audio device but result is same, pls help me
Hi, thx for this, it’s really helpfull, i was just wondering if there is also a way to get not altabbed when playing a game for example and you pres f6 or f7?
For all non-english windows users; you have to change the file according to the following pattern:
ControlClick,&***
where *** is what the drop-down button in sound devices says when a non-standard device is selected,
WinWait,#
where # is the term that is used instead of “sound” in your windows version.
For example, in german Win7 it’s
WinWait,Sound
ControlClick,&Als Standard
Skrypt zmieniający automatycznie domyślne urządzenie audio w win7:
For Polish UI working code is:
*F6::
Run, mmsys.cpl
WinWait,Dźwięk
ControlSend,SysListView321,{Down 1}
ControlClick,&Ustaw domyślne
ControlClick,OK
return
*F7::
Run, mmsys.cpl
WinWait,Dźwięk
ControlSend,SysListView321,{Down 2}
ControlClick,&Ustaw domyślne
ControlClick,OK
return
Thank you so much! exactly what i was looking for, only wish I came across this article sooner
Glad it helped!
I love you man! I just bought G930 headset and was facing this same problem,…big thanks!
We love the G930s :) !
Thanks a bunch for this. So much easier with this script !
SOmehow it doesn`t work for me i follow the steps excactly as you say i did it again but nothing when i press the fuction keys it just open the panel of the playback devices and that all the command stops there
i guess i have to change the commands in my language but still nothing does the script understands the Greek characters?
Great! Thanks for the tip. I will give that a try and probably update the post.
A way to toggle this would be fantastic, is there a way to have it check if one is currently active and then switch to the one which is not active? Out of two chosen devices of course, if this can be done it would help me greatly as I’d like to only have one macro key taken up with this.
I don’t know of a way to automatically toggle this. Check on the autohotkey.com forums… they might have some new updates from someone that could do this.
Even simpler is to use FastKeys, It handles this very well plu has tons of other features – you can even import full AHK scripts. Check fastkeys.vze.com.
Thank you for your comment! I will have to check that out.
Would be useful if you could type it out so I could copy and paste it in to avoids typos and misreading etc. Thanks.
Thank you for your comment, I have pasted the contents of the .ahk file above now in Step 3.
SoundSwitch didn’t exist when we originally wrote this. I just gave that a try and it works great! We just edited our article and put your suggestion at the bottom of the post. Thanks for your comment!
I Brian!
I’ve been trying for 2h now to make this to work and without success…
My default windows language is “Portuguese”.
I’ved tried everything i could think off…
The portuguese word for “sound” is “Som”.
Thanks
Thank you, works great!
Great, glad it helped!
For Windows 8 small change is required (because of two default output devices, for playback and communication):
*F6::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 4}
ControlClick,&Set Default
ControlSend,SysListView321,{Down 1}
ControlClick,OK
return
*F7::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 3}
ControlClick,&Set Default
ControlSend,SysListView321,{Down 1}
ControlClick,OK
return
Great. Thank you for sharing with our readers.
Hi! This script has worked for me beautifully! Thanks! But I want to ask, how do I do the same thing, but for recording devices? What part of the script would I have to replace? Thanks again!
Good question. This is worth a blog post.
For the Finnish Windows 8.1 users:
*F6::
Run, mmsys.cpl
WinWait,Ääni
ControlSend,SysListView321,{Down 3}
ControlClick,&Aseta oletus
ControlSend,SysListView321,{Down 1}
ControlClick,OK
return
*F7::
Run, mmsys.cpl
WinWait,Ääni
ControlSend,SysListView321,{Down 2}
ControlClick,&Aseta oletus
ControlSend,SysListView321,{Down 1}
ControlClick,OK
return
How do you change the order in which devices are listed? Everytime I plug in a headset the order changes and everything goes to hell.
Great script – thanks for sharing!
Awesome! This is exactly what I needed! Thank you!
This worked perfectly! I love ahk!!! Thank you.
btw to avoid accidental keypresses I switched the *F6 to +F6 which is shift + F6 pressed together as the hot key.
Hi, this did now work for me.
The only way I can switch between my speakers and headphones is if I disable the other. Is there a script where you can enable/disable speakers and my G930 headset?
Thank you
If you need it to toggle here is a simple switch:
soundSwitch = 1
*F2::
Run, mmsys.cpl
WinWait,Sound
if soundSwitch = 1
{
ControlSend,SysListView321,{Down 1}
ControlClick,&Set Default
ControlClick,OK
soundSwitch = 2
}
else
{
ControlSend,SysListView321,{Down 2}
ControlClick,&Set Default
ControlClick,OK
soundSwitch = 1
}
return
put that into your autohotkey.ahk and press F2 :)
Thanks for the great script! Windows 10 requires slightly different action for the default button though, as it now has a drop down.
*F6::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 2} ; This is my headphones
ControlFocus,&Set Default
Send,{Down 2}
Send,{Enter}
ControlClick,OK
return
*F7::
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 3} ; This is the laptop speakers
ControlFocus,&Set Default
Send,{Down 2}
Send,{Enter}
ControlClick,OK
return
I mapped my headphones to ^!h and speakers to ^!s. (I use ctrl-alt-key so as to not interfere with Visual Studio)
With this should work in all languages
I have windows 10 italian, couldn’t make the script working
you only need to change:
WinWait, Sound <— change SOUND with the title of the window in your language
example: in italian: WinWait, Audio
and of course change the number of your device
Run, mmsys.cpl
WinWait,Sound
ControlSend,SysListView321,{Down 3}
Send !{E}
ControlClick,OK
return
With this should work in all languages
I have windows 10 italian, couldn’t make the script working
you only need to change:
WinWait, Sound <— change SOUND with the title of the window in your language
example: in italian: WinWait, Audio
and of course change the number of your device
Run, mmsys.cpl
WinWait, Sound ;change with the title of window in your language
ControlSend,SysListView321,{Down 3} ;change with the device you need to change
Send !{E} ;change E, explained below
ControlClick,OK
return
ps. info for the E or other key:
1. open the audio device window
2. click ALT key
3. now only a letter in buttons is underlined
4. that mean you are able to activate this button with: ALT + (underlined letter) key combination
5. change the script with the letter you need
ps. this same comment was detected as spam. wtf?