Hotkey to Switch Audio Devices on Windows

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.

autohotkey x32 and x64

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

READ ALSO  Speed Up FileZilla FTP Transfers

*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.”

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.

Speakers

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.

autohotkey

Step 7

Now launch AutoHotkey from your program files, and it will run on your taskbar.

autohotkey

Step 8

I recommend reloading the script. Right click on AutoHotKey running in your taskbar and select “Reload this script.”

autohotkey - reload 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.

READ ALSO  How to Reset and Clear Avaya 5610SW IP Phone Settings

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.

audio switcher windows

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.

audio switcher

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 windows 10

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.

READ ALSO  Automatically Accept Meeting Requests in Microsoft Outlook

audio switcher hotkey

Cyril Kardashevsky
Latest posts by Cyril Kardashevsky (see all)

52 comments

  1. 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

    1. 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.

  2. 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?

      1. 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 :)

          1. Your very welcome… seeing from Google translator… I’m assuming you said the following?? “Thanks for the help there, Hannes! Now it works!”

    1. *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

    2. 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,

  3. 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.

  4. 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 ;-)

  5. 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

  6. 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?

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

    1. 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

  8. 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

  9. 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.

  10. 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.

  11. 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!

  12. 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

  13. 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

  14. 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!

  15. 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

  16. 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.

  17. 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.

  18. 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

  19. 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 :)

  20. 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)

  21. 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

  22. 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?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.