122

Some keyboards have volume controls on them that can be pressed anytime to control the master volume. My keyboard does not have that. Is there a way that I can create a key macro that will work like the volume controls on those keyboards?

It should always allow me to control the volume, even if I'm playing a game.

14 Answers 14

107

I just did this with my laptop. I used AutoHotKey

Here is the script

#PgUp::Send {Volume_Up 1}
#PgDn::Send {Volume_Down 1}

so doing Win+PgUp Win+PgDown changes the master volume. If you prefer Ctrl+PgUp, use ^PgUp::Send.

  1. If you don't have it installed already, http://www.autohotkey.com/
  2. Once installed, right click your Desktop, and choose new AutoHotKey file
  3. Make sure to title the file ending with .ahk (for example, I used "controls.ahk")
  4. Paste the code in from above
  5. Save it, and double click the script in windows explorer

To run it at startup

  1. Use the AHK provided "Convert to exe" utility (or you can right click the file and select "compile script")
  2. Create the .exe in "C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup"
9
  • 3
    For followers, note that sending Volume_Up is basically the same as instructing AHK to simulate hitting the volume up button on the keyboard.
    – rogerdpack
    Jul 13, 2010 at 23:23
  • 3
    This is cool, it works on win7, and change the step from 3 to 1 would get a better control.
    – Eric
    Aug 26, 2015 at 2:43
  • 3
    Also works on Win 10
    – H A
    Jun 4, 2016 at 5:47
  • 1
    Does this mean that Volume_Up and Volume_Down are completely unique keyboard signal codes that don't translate into other basic keystroke combo?
    – icelava
    Dec 12, 2019 at 10:25
  • 1
    I have the same question as @icelava. Seems insane that there isn't a simple simple command of some kind that is inherent to the Windows OS. Having to install an entirely new application to create custom scripts just to send a volume up/down command seems overkill.
    – A__
    Sep 30, 2022 at 1:44
76

Do:

Win + B

Left

Enter

PgUp/PgDown

Escape

This allows you to interact with the notification icons on the right side of the taskbar using the keyboard. Win + B brings focus to one of the taskbar icons, Left will move focus until you have focus on the volume icon, Enter will open the volume slider up, and PgUp/PgDown moves the slider.

4
  • 11
    You can also use Up/Down instead of PgUp/PgDown for finer control of the volume.
    – Kevin
    Jul 17, 2014 at 15:59
  • 1
    I can only use Up/Down fwiw. Also, there were some icons in between the one Win + B focuses on and the volume icon requiring more Right presses, but you can drag that to be right next to it.
    – MSpreij
    Mar 7, 2018 at 13:34
  • @Mspreij ditto, Win10. Last edit was 2014 so probably PgUp defunct Aug 6, 2020 at 12:21
  • @Christian Chapman, any advice to remove the annoying sound after release the arrows keys when trying to up/down the volume level ? Mar 27, 2021 at 18:56
27

There is a good enough solution that does not require installing additional programs:

  1. Click your start menu and type sndvol in the search box
  2. Create a shortcut on your desktop for it (right-click -> Send to Desktop (create shortcut)
  3. Right-click on the new shortcut and edit Properties
  4. On the Shortcut tab, set the box “shortcut key” to your prefrence. For example: CTRL + ALT + V, and hit OK.

Now you can press your shortcut keys and the volume control box will popup. Then use the UP and DOWN arrows to change the volume, and ESC to close.

Recipe taken form this blog post.

2
  • 3
    Alternatively, add the shortcut to the taskbar and make sure it is somewhere to the left. The combination Wnd + <n> will launch the n-th application, leftmost = 1. Jul 1, 2016 at 15:01
  • But does that work with those games with restricted windows? May 4, 2020 at 18:06
23

Volumouse

provides you a quick and easy way to control the sound volume on your system - simply by rolling the wheel of your wheel mouse.

2
  • 1
    When I'm in a game and I try to use this, it causes the game to become minimized.
    – Phenom
    Dec 12, 2009 at 19:38
  • Worked for me. The UI is not particularly intuitive, but Vol+/- worked out of the box (Alt+scroll wheel). To get Mute working with the scroll wheel, I added two rules for Mute: Alt-Ctrl and Left mouse button down, both applied to the Speakers Component with Channel=Mute/Unmute. I also had to change Vol+/- to be Alt+Shift (plain Alt prevented my Alt-Ctrl setup from working with Mute). And yes, "Left mouse button is down" is what made the scroll wheel work for me. Maybe it's mis-mapped?
    – kghastie
    Jul 22, 2016 at 14:33
6

NirCmd is an application that changes the volume and more.

Example of use:

  • Increase the system volume by 2000 units (out of 65535)
    nircmd.exe changesysvolume 2000
  • Decrease the system volume by 5000 units (out of 65535)
    nircmd.exe changesysvolume -5000
  • Set the volume to the highest value
    nircmd.exe setsysvolume 65535

You could use it, together with AutoHotkey to invent your own volume keys.

6

Just found open source software 3RVX which "provides an on-screen display (OSD) for Windows systems. It supports skinnable volume and eject OSDs as well as a range of hotkey controls, tray notifications, and other cool features. Simulates the look and feel of the OS X volume overlay (different skins are available) and you can configure key combinations."

Also available on GitHub

0
5

The best way I found for manipulating the system volume level on Windows without the need for installing additional software is to use VBScript in one of the following ways:

Toggle muted:

Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys(chr(&hAD))

Increase volume level:

Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys(chr(&hAF))

Decrease volume level:

Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys(chr(&hAE))
1
  • But how does that relate to a key macro (from the question)? May 4, 2020 at 18:09
4

You can use the official Powertoys made by Microsoft for this.

Go to keyboard manager to map a key combination of your choosing to volume up/down.

enter image description here

3

You could use this AutoHotkey macro: Volume On-Screen-Display (OSD) -- by Rajat

The interesting part is here:

vol_WaveUp:
SoundSet, +%vol_Step%, Wave
Gosub, vol_ShowBars
return

vol_WaveDown:
SoundSet, -%vol_Step%, Wave
Gosub, vol_ShowBars
return

vol_MasterUp:
SoundSet, +%vol_Step%
Gosub, vol_ShowBars
return

vol_MasterDown:
SoundSet, -%vol_Step%
Gosub, vol_ShowBars
return

If you modify the script and remove the "Gosub", you can change the volume without the OSD bars.

3
2

Try Sound Volume Hotkeys

This tool allows to control sound volume using system-wide hotkeys. Customizable on-screen sound volume indicator will show you the current level.

enter image description here enter image description here

2
  • 3
    Nice free software, but it's hard-coded to use Ctrl+Arrow Up/Down Aug 5, 2012 at 5:39
  • @LessanVaezi Yes, it is. I dislike that too. Aug 7, 2012 at 6:23
0

My favorite way of controlling the master volume use the scroll wheel while the cursor is over the taskbar via AutoHotkey:

#If MouseIsOver("ahk_class Shell_TrayWnd")
WheelUp::Send {Volume_Up}     ; Wheel over taskbar: increase/decrease volume.
WheelDown::Send {Volume_Down} ;

See https://autohotkey.com/docs/Hotkeys.htm for more details

To make it possible to control the volume wherever the cursor is (while capslock is pressed), you can add the following:

capslock & wheelup::Send {Volume_Up}
capslock & wheeldown::Send {Volume_Down}
1
  • Scroll wheel? On a keyboard or a mouse? May 4, 2020 at 18:09
0

My findings on this topic:

I stumbled across an AutoHotKey_L library while trying to overwrite my keyboard's Volume_Up and Volume_Down global hotkeys.

The purpose was to be able to control master volume while running restrictive, key press consuming fullscreen applications/games (Bethesda's games as an infamous example).

The functions are pretty straightforward, so I'll just post a little example:

Volume_Up::
    newVol := VA_GetMasterVolume() + 5
    VA_SetMasterVolume(newVol)
return

Volume_Down::
    newVol := VA_GetMasterVolume() - 5
    VA_SetMasterVolume(newVol)
return

In principle, this code contains everything you'll need. It overwrites both keys to do the same as before, but instead of relying on the OS to catch the keypress, AutoHotkey sets the volume by itself. Of course, you can specify any other hotkey.

Since there doesn't seem to be a built-in function to change the volume relatively, you'll have to get the current volume first and then in-/ decrease it at will (here: 5). VA_SetMasterVolume accepts values between 0.0 and 100.0, inclusive.

To get this working in a restrictive fullscreen windows, it was sufficient to call the #UseHook directive at the top of my script.

References:

  1. Library download: Vista Audio Control Functions by Lexikos
  2. VA Online documentation
0

Another option is SharpKeys:

https://github.com/randyrants/sharpkeys

it allows you to remap one key to another. This is the setup I used for example:

Map this key | To this key
-------------|------------
Function F10 | Media volume down
Function F11 | Media volume up
0

I installed AutoHotkey and used the following script:

#MaxHotkeysPerInterval 500
#WheelUp::Volume_Up
#WheelDown::Volume_Down
#MButton::Volume_Mute

This gives me:

  • Alt + MouseWheelUpVolume Up
  • Alt + MouseWheelDownVolume Down
  • Alt + MouseWheelClickMute/Unmute

Pretty convenient!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .