How to set up keyboard shortcuts for -/+ing individual audio channels with built in KDE tools?

Hello World,

Whether because my hearing is starting to suck with age, or because Linux still isn’t quite there yet with how it handles audio(I say this part because some of the other Linux behavior I have to put up with when it comes to audio would make your head spin!!!) something I have to do many many times every single day is right click the the volume icon on the taskbar → left click Configure Audio Devices → and then manually adjust the volume of one of the stereo channels of my headphones up or down a bit.

Is there a simple command I could enter in the keyboard shorcuts section of the system settings panel of KDE to assign some key combos that could increase/decrease the volume of a single channel?

To clarify, I am not asking if this can be achieved at all or not, I am sure it can using third party apps that I could probably google and figure out myself, what I am asking is if this can be achieved with the tools the system already comes with, without me having to add anything extra?
For example I already have some custom shortcuts set up to auto enter text in the text filed I am currently in when I press a key combo. For that I use sleep 1; xdotool type "whatever you want here" as the command. So as you can see simple, no need to install anything else, is there something similar I can do for my audio issue?

Thank you.

Did you tried Settings->Keyboard->Shortcuts->Sound and media (I translated the menue entries, so they might be a bit different)?

Please don’t (use ChatGPT) if you not are able to correct the crap you get out of AI.

Fedora Linux uses since F34 PipeWire!

wpctl is a useful tool but the way it is proposed to use not gives the correct output.

Please correct, otherwise we do have to discuss to remove this answer you gave.

It is unfriendly while users spent a lot of time to help here while they make investigations and share personal knowledge and you as a brand new user showing up and post such vague information.

2 Likes

Ok, problem right from the start, I entered the sinks command and this is what I got:

If it helps this is what I have in my sound settings:

Let me know if there is any other info I should provide please, thank you.

LE: Oh, I posted this at pretty much the same time as @ilikelinux said his piece so I didn’t notice his post initially, should I take it that my issue was to be expected then(reminder, Linux newbie over here)? :pleading_face:

The answer I gave is because of posting chat gpt answers without testing!

use the command without the | grep to see the options you have

Ok, I know it’s me being stupid but I can’t understand what I am doing wrong, a bit more help pretty please?:

VIKINGS@VIKINGSKINGDOM:~$ wpctl status | grep 'Sinks'
 ├─ Sinks:
 ├─ Sinks:
VIKINGS@VIKINGSKINGDOM:~$ wpctl status
PipeWire 'pipewire-0' [1.2.7, VIKINGS@VIKINGSKINGDOM, cookie:3906293842]
 └─ Clients:
        32. uresourced                          [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:1962]
        33. WirePlumber                         [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:1965]
        34. pipewire                            [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:1967]
        36. libcanberra                         [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2274]
        40. plasmashell                         [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2274]
        49. WirePlumber [export]                [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:1965]
        61.                                     [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2274]
        70. easyeffects                         [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2778]
        71. kwin_wayland                        [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:1975]
        72. QtPulseAudio:2112                   [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2112]
        73. libcanberra                         [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2211]
        74.                                     [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2211]
        75. xdg-desktop-portal                  [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:1998]
       128.                                     [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:2211]
       147. Strawberry device finder            [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:3740]
       150. System Settings                     [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:22172]
       166. wpctl                               [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:22977]
       177. Strawberry                          [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:3740]
       186. Brave input                         [1.2.7, VIKINGS@VIKINGSKINGDOM, pid:4522]

Audio
 ├─ Devices:
 │      50. Navi 31 HDMI/DP Audio               [alsa]
 │      51. RC30-026902, Gaming Headset [Nari Essential, Wireless, Receiver] [alsa]
 │      52. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      53. Family 17h/19h/1ah HD Audio Controller [alsa]
 │     130. Audeze Maxwell XBOX Dongle          [alsa]
 │  
 ├─ Sinks:
 │      35. RC30-026902, Gaming Headset [Nari Essential, Wireless, Receiver] Analog Stereo [vol: 0.85]
 │      60. Easy Effects Sink                   [vol: 1.00]
 │      64. Navi 31 HDMI/DP Audio Digital Stereo (HDMI) [vol: 0.40]
 │  *  131. Audeze Maxwell XBOX Dongle Pro      [vol: 0.40]
 │     132. Audeze Maxwell XBOX Dongle Pro 1    [vol: 1.00]
 │  
 ├─ Sources:
 │      48. RC30-026902, Gaming Headset [Nari Essential, Wireless, Receiver] Mono [vol: 1.00]
 │      69. Easy Effects Source                 [vol: 1.00]
 │  *  133. Audeze Maxwell XBOX Dongle Pro      [vol: 1.00]
 │  
 ├─ Filters:
 │  
 └─ Streams:
       178. Strawberry                                                  
            179. output_FR       > Easy Effects Sink:playback_FR        [active]
            181. output_FL       > Easy Effects Sink:playback_FL        [active]

Video
 ├─ Devices:
 │  
 ├─ Sinks:
 │  
 ├─ Sources:
 │  
 ├─ Filters:
 │  
 └─ Streams:

Settings
 └─ Default Configured Devices:
         0. Audio/Sink    alsa_output.usb-Audeze_LLC_Audeze_Maxwell_XBOX_Dongle_0000000000000000-01.iec958-stereo
VIKINGS@VIKINGSKINGDOM:~$ wpctl set-volume 131 0.45:0.40
Error: Invalid volume argument. See wpctl set-volume --help

Usage:
  wpctl [OPTION…] COMMAND [COMMAND_OPTIONS] - WirePlumber Control CLI

Command: set-volume ID VOL[%][-/+]
  Sets the volume of ID from specified argument. (floating point, 1.0 is 100%)
  VOL%[-/+] - Step up/down volume by specified percent (Example: 0.5%+)
  VOL[-/+] - Step up/down volume by specified value (Example: 0.5+)
  VOL - Set volume as the specified value (Example: 0.5)

Help Options:
  -h, --help       Show help options

Application Options:
  -p, --pid        Selects all nodes associated to the given PID number
  -l, --limit      Limits the final volume percentage to below this value. (floating point, 1.0 is 100%)

VIKINGS@VIKINGSKINGDOM:~$ wpctl set-volume 131- 0.45:0.40
Error: Invalid volume argument. See wpctl set-volume --help

Usage:
  wpctl [OPTION…] COMMAND [COMMAND_OPTIONS] - WirePlumber Control CLI

Command: set-volume ID VOL[%][-/+]
  Sets the volume of ID from specified argument. (floating point, 1.0 is 100%)
  VOL%[-/+] - Step up/down volume by specified percent (Example: 0.5%+)
  VOL[-/+] - Step up/down volume by specified value (Example: 0.5+)
  VOL - Set volume as the specified value (Example: 0.5)

Help Options:
  -h, --help       Show help options

Application Options:
  -p, --pid        Selects all nodes associated to the given PID number
  -l, --limit      Limits the final volume percentage to below this value. (floating point, 1.0 is 100%)

VIKINGS@VIKINGSKINGDOM:~$ wpctl set-volume 131 -0.45:0.40
Error: Unknown option -0.45:0.40

Usage:
  wpctl [OPTION…] COMMAND [COMMAND_OPTIONS] - WirePlumber Control CLI

Command: set-volume ID VOL[%][-/+]
  Sets the volume of ID from specified argument. (floating point, 1.0 is 100%)
  VOL%[-/+] - Step up/down volume by specified percent (Example: 0.5%+)
  VOL[-/+] - Step up/down volume by specified value (Example: 0.5+)
  VOL - Set volume as the specified value (Example: 0.5)

Help Options:
  -h, --help       Show help options

Application Options:
  -p, --pid        Selects all nodes associated to the given PID number
  -l, --limit      Limits the final volume percentage to below this value. (floating point, 1.0 is 100%)

VIKINGS@VIKINGSKINGDOM:~$ wpctl set-volume 131 VOL-0.45:0.40
Error: Invalid volume argument. See wpctl set-volume --help

Usage:
  wpctl [OPTION…] COMMAND [COMMAND_OPTIONS] - WirePlumber Control CLI

Command: set-volume ID VOL[%][-/+]
  Sets the volume of ID from specified argument. (floating point, 1.0 is 100%)
  VOL%[-/+] - Step up/down volume by specified percent (Example: 0.5%+)
  VOL[-/+] - Step up/down volume by specified value (Example: 0.5+)
  VOL - Set volume as the specified value (Example: 0.5)

Help Options:
  -h, --help       Show help options

Application Options:
  -p, --pid        Selects all nodes associated to the given PID number
  -l, --limit      Limits the final volume percentage to below this value. (floating point, 1.0 is 100%)

VIKINGS@VIKINGSKINGDOM:~$ wpctl set-volume 131 VOL 0.45:0.40
Error: Invalid volume argument. See wpctl set-volume --help

Usage:
  wpctl [OPTION…] COMMAND [COMMAND_OPTIONS] - WirePlumber Control CLI

Command: set-volume ID VOL[%][-/+]
  Sets the volume of ID from specified argument. (floating point, 1.0 is 100%)
  VOL%[-/+] - Step up/down volume by specified percent (Example: 0.5%+)
  VOL[-/+] - Step up/down volume by specified value (Example: 0.5+)
  VOL - Set volume as the specified value (Example: 0.5)

Help Options:
  -h, --help       Show help options

Application Options:
  -p, --pid        Selects all nodes associated to the given PID number
  -l, --limit      Limits the final volume percentage to below this value. (floating point, 1.0 is 100%)

VIKINGS@VIKINGSKINGDOM:~$ wpctl set-volume 131 VOL [0.45:0.40]
Error: Invalid volume argument. See wpctl set-volume --help

Usage:
  wpctl [OPTION…] COMMAND [COMMAND_OPTIONS] - WirePlumber Control CLI

Command: set-volume ID VOL[%][-/+]
  Sets the volume of ID from specified argument. (floating point, 1.0 is 100%)
  VOL%[-/+] - Step up/down volume by specified percent (Example: 0.5%+)
  VOL[-/+] - Step up/down volume by specified value (Example: 0.5+)
  VOL - Set volume as the specified value (Example: 0.5)

Help Options:
  -h, --help       Show help options

Application Options:
  -p, --pid        Selects all nodes associated to the given PID number
  -l, --limit      Limits the final volume percentage to below this value. (floating point, 1.0 is 100%)

VIKINGS@VIKINGSKINGDOM:~$ 

Nobody said that, your question is valid. What I disliked is the first answer you became from a user using ChatGPT and just posts the whole thing without having a deeper look and testing it.

Audio
 ├─ Devices:
 │      50. Navi 31 HDMI/DP Audio               [alsa]
 │      51. RC30-026902, Gaming Headset [Nari Essential, Wireless, Receiver] [alsa]
 │      52. Rembrandt Radeon High Definition Audio Controller [alsa]
 │      53. Family 17h/19h/1ah HD Audio Controller [alsa]
 │     130. Audeze Maxwell XBOX Dongle          [alsa]
 │  

Which device you like to change the volume ? The number in front, is the ID you looked for with the not working command you got.

I was referring to me not usually understanding --help explanations(it’s not the first time) that appear for various things in the console or how to use them. :blush:

The Audeze Maxwell XBOX Dongle which if I am supposed to take the number from devices I guess would be 130, I thought I was supposed to use the one from the sinks section, where it’s 131 for the same thing. But cool, I’ll try those commands again with 130 and see what I get.

LE: Well, I just went through all permutations I could think of with 130 too, same result. :worried:

I found out how to increase in percentage:

$ wpctl set-volume 60 4.00%+    #incremental of 4%. To decrease substitute + with -
$ wpctl get-volume 60           # 60 is the ID of my HDMI Device 

Can you test if this helps for you? I use the speakers on my Monitor :

Audio
 ├─ Devices:
 │      45. Built-in Audio                      [alsa]
 │      46. FHD Camera Microphone               [alsa]
 │  
 ├─ Sinks:
 │  *   60. Built-in Audio Digital Stereo (HDMI) [vol: 0.54]
 │

btw, this at least gives me a result:
wpctl status |grep -i sinks*

The grep command didn’t work because the output is on a different line.

The corrected command would be:

wpctl status | grep -A 1 'Sinks'
1 Like

This just prooves how Chat GPT is useless.

3 Likes

Sure I’ll test it as soon as I can use the console again(atm yt-dlp is downloading something), but I think I already know the problem I am gonna have with that command even if it works, and that is that it will probably increase all the volume? Whereas I want to increase the volume of just a single channel. :cry:

I even recognized an other issue, that the ID was changing as soon as I opened the Settings?
This will not help when you try to make a script/shortcut.

:sob: snif :sob:

LE: Ok I’ve had time to test it @ilikelinux , and it’s a doozy…:

  1. The command works to increase volume and I don’t have to open the settings for that to happen like you said.
  2. Like I feared it increases the volume for all the channels, so if we could figure out how to increase just one earcup that would be awesome.
  3. Sadly it “works” in a buggy way, for example it adds an extra % and a : in diferent places after I type the command in, give it a name and hit add.
    As a result increaseing the volume works, but decreasing it does not at the moment, looool… :crazy_face: :tired_face: Maybe because that : gets set in a different place!!!.. I seriously don’t understand any of this anymore…

Anyway, here are some screens of what I am talking about, maybe you can make some sense out of them?

You could use the amixer command instead.

With amixer without options you’ll get the name of the output device. In my case it’s Master.

Then you can adjust the volume of only specific channels (frontleft and frontright in my case):

amixer set Master frontleft 5%-

To avoid the output (when using the shortcut):

amixer set Master frontleft 5%- >/dev/null
# or
amixer set -q Master frontleft 5%-
3 Likes

Ok, after some fiddling around and having to restart the system @tqcharm 's command seems(for the moment) to work like a charm!!! :grin: :man_dancing: :star_struck:

So I’m gonna mark his post as solution, but thank you very much to everyone for your help and suggestions! :hugs:

1 Like