How to change the volume of different programs with your keyboard

I have a Corsair K70 keyboard which has a volume scrollbar. I was wondering if it is possible to e.g. press a function key (F1 - F12), than use the volume scrollbar to change the volume of a specific program.

Here an example situation:

I am in-game and I have Spotify on, I am listening to some music. At a certain point I want to turn down the volume of Spotify, but not the volume of the game. So instead of adjusting the master volume, I want to adjust the volume for Spotify specifically, without needing to ALT-Tab out of the game. Preferably by pressing F1-F12 and scrolling the volume bar.

Any tips? :)


Any tips? :)

Yes. Trying to control the audio of individual programs in Windows can be a headache and you should give up now. ;)

Kidding aside, Windows audio isn't necessarily uniform regarding implementation. So while what you want isn't theoretically impossible (as demonstrated below), it might not always be easy (or possible) to find a combination of software that produces the results you desire.

This Is Not The Solution You Are Looking For...

In terms of a generic application to adjust audio volumes individually, your best bet would be NirSoft Volumouse. It's a free utility intended to map application volumes to modified mouse scroll wheel movements (though this isn't required). Furthermore, if paired with an additional hotkey program (such as AutoHotkey), you should be able to adjust the volume of at least some applications in the manner you describe.


Note that I am making the assumption your scrollbar sends Volume Up and Volume Down messages, similar to normal media keys. If this isn't the case, this solution may need additional research/steps.


Get Volumouse

Download Volumouse from the links near the bottom of its main page. Make sure to pick the package (32-bit or 64-bit zip file) that matches the "bitness" of your Windows version. Volumouse doesn't require installation and you can place it wherever you want it to live after unpacking. Open Volumouse when you're done.

Volumouse Settings

When Volumouse first opens, the basic Volumouse Options window will normally appear. Apart from what I suggest below, you will probably need to change very little in this main window. Basic settings are detected automatically and don't usually seem to require adjustment.

The only items you will almost always want to change are the dropdowns marked Use the wheel when under the Mouse Wheel Rules section:

ex. Volumouse Options Window

Volumouse Options Window

Each line of the Mouse Wheel Rules section represents a slot for a potential hotkey/application volume combination and the dropdowns mentioned partially affect hotkey settings for each one.

Since you'll likely want to assign keyboard shortcut as the volume controls for an individual application (rather than mouse-based ones), you should select Use hot-keys instead of mouse wheel for each such case. To configure the remaining options for an individual combination, you will need to press the More... button to the right of each slot you wish to use.

Advanced Rule Options Window

Each More... button brings up a single Advanced Rule Options window for the given slot. The two primary items that need to be set in your case are:

  • Under Windows 7/Vista/2008 Options, select the dropdown item marked Change the volume for specified .exe. file. In the blank field directly beneath, provide the full Windows path to the main executable you wish to control e.g. C:\Path\To\Spotify.exe.

  • Under the Hot Keys section, enter the desired key combinations for both the Increase and Decrease fields (click the field and press the actual keys). The combinations you press should appear in the fields afterwards if done correctly. If these fields are greyed out, you forgot to set Use the wheel when to Use hot-keys instead of mouse wheel.

Optionally, under Indicator Options, I would select None. It avoids any issues with an ugly flickering volume indicator by hiding it, as well as the indicator being visually useless in at least some full-screen games.

Once you're finished, press OK to close the Advanced Rule Options window. Note that you need to click Apply at the bottom of the main Volumouse Options window every time you update settings in an Advanced Rule Options window or your new settings will not be retained.

Testing

You can now test your hotkeys by launching any mapped applications and attempting to use the appropriate shortcuts you gave above. You can normally watch the volume levels in the regular Windows audio mixer to confirm things are working as intended.

Mapping The Volume Scrollbar

At this point, you should have a (generally) working setup to control an application's volume individually. Unfortunately, as far as I can tell, Volumouse doesn't have a good mechanism for dealing with media key Volume Up and Volume Down signals (what I'm assuming your volume scrollbar sends).

To address this, we can use an additional hotkey program to translate a sequence such as F11+Scrollbar (Up/Down) into key presses for Volumouse. As previously mentioned, I suggest AutoHotkey, which you can download from this page. AutoHotkey is free and runs as a system tray icon, similar to Volumouse.

Creating An AutoHotkey Script

AutoHotkey receives instructions from a custom script you provide it at startup. This script is a simply text file (often renamed to .ahk for file association purposes) and can contain multiple hotkey definitions. For you, the script might look something like:

ex. AutoHotkey Script

; Application 1
f11 & Volume_Up::Send ^v
f11 & Volume_Down::Send ^f

; Application 2
f12 & Volume_Up::Send ^u
f12 & Volume_Down::Send ^d

To break this script down:

  • ; is a comment

  • fXX & Volume_XX are the hotkeys for the scrollbar (what you want to use for your final shortcuts). fxx are F-keys (1-12), while & ties the keys together.

  • :: is a simple instruction delimiter.

  • Send says that whenever AutoHotKey detects a given combination (e.g. f11 & Volume_Up), it should intercept those key strokes and send an alternate set of key presses instead.

  • ^v, etc. are the alternate key presses to send. ^ is a special AutoHotkey character representing the Ctrl key. These are just examples, obviously — the key presses you list would match the keyboard shortcuts you created in Volumouse for each application. A basic list of AutoHotkey special characters can be found here.

To use the script, you would simply save it as an .ahk file then double click the saved file to start AutoHotkey with that script. For batch files and desktop shortcuts, it's also possible to use an AutoHotkey script as a command line parameter to AutoHotkey itself.


Caveats

  • Both Volumouse and AutoHotkey have to be running for this solution to work. So using this solution means that every application will have four potential volume shortcuts associated with.

  • Pick your shortcuts carefully. They can (potentially) interfere with "normal" keyboard operations or the use of shortcuts in other programs. Single letter hotkeys in particular can interfere with typing or have other odd side effects.

  • You'll likely want to avoid hotkey combinations with the Windows key as well, since they can make games pop back to the desktop.

  • If a program runs as an administrator, Volumouse must be run as an administrator as well.

  • Volumouse/AutoHotkey may have unknown accidental conflicts with other applications (e.g. another application is hooking some of the same keys).

  • Since Volumouse can be slow to respond occasionally, marking the option to give it a high priority in the main Volumouse Options window may be something to consider.

  • I'd be hesitant to adjust game audio with this method. In-application audio sliders (or whatever) may not be adjusted with Volumouse. This means an internal audio slider can be set to maximum and still register no audio if that audio was set to 0 with Volumouse shortcuts. And while proper audio levels can easily be restored in the Windows mixer when an application is running, windowing a game (or popping back to the desktop) seems to be what you're trying to avoid.


Other Notes

Program Compatibility

  • The solution I provide should work with many applications, but program compatibility (especially with Volumouse) isn't guaranteed.

  • Volumouse works with at least some regular Windows 10 applications, such as the desktop version of Spotify.

  • Regarding Windows 10 Universal Apps, they do have an .exe file associated with them but those typically require Powershell to find and I didn't bother to go through the process of testing any for compatibility with Volumouse.

Volumouse Misc.

  • I didn't attempt to test any kind of direct per-application muting (Volumouse has no option for that, I believe). Ditto for skipping forwards or backwards (e.g. in media players).

  • When entering the full path to the executable in Volumouse, I didn't use double-quotes (I tend not to have spaces in my application paths). That said, I don't know if they might be required for paths with spaces or not.

  • Volumouse adjusts an applications volume as a percentage of the current overall system volume. This means playing audio at quiet levels can mean a lot more scrolling to adjust the volume.

  • The maximum volume of an application's audio as managed by Volumouse will never be louder than the system volume, as normal.


It's easy turn on the game bar.

go to settings-gaming-xbox game bar

enable xbox game bar

then press win+g

And you can add widgets such as crosshair for the game, Spotify song controller, screen recorder and you can just simply control audio for an app just press win+g After enabling xbox game bar. Thank you

(works only in windows 10)