2

I currently use custom created keyboard shortcuts to change the volume of my computer. The terminal commands I use are:

amixer sset Master 3%+
amixer sset Master 3%-

This changes the volume of the "Built-in Audio Analog Stero" levels in the picture below. However, this does not control the volume of my bluetooth devices that I connect using the blueman app. In pavucontrol > Output Devices I see that the bluetooth device uses the Speaker port, but this does not work:

amixer sset Speaker 3%+
amixer: Invalid command!

enter image description here

If this matters, MATE volume control shows: enter image description here

How can I have the master volume be a "global" volume able to change the volume for the bluetooth device?

More info from alsamixer:

Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 69 [79%] [-13.50dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [on]
  Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Speaker',0
  Capabilities: pswitch
  Playback channels: Front Left - Front Right
  Mono:
  Front Left: Playback [on]
  Front Right: Playback [on]
Simple mixer control 'PCM',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [on]
  Front Right: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Beep',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 31
  Mono:
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 51 [81%] [21.00dB] [off]
  Front Right: Capture 51 [81%] [21.00dB] [off]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Speaker Only' 'Line Out+Speaker'
  Item0: 'Line Out+Speaker'
Simple mixer control 'Digital',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 120
  Front Left: Capture 81 [68%] [10.50dB]
  Front Right: Capture 81 [68%] [10.50dB]
Simple mixer control 'Dock Mic',0
  Capabilities: pvolume pswitch cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Mono
  Limits: Playback 0 - 31
  Mono: Capture [off]
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Dock Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'Headset Mic',0
  Capabilities: pvolume pswitch cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Playback channels: Front Left - Front Right
  Capture channels: Mono
  Limits: Playback 0 - 31
  Mono: Capture [off]
  Front Left: Playback 0 [0%] [-34.50dB] [off]
  Front Right: Playback 0 [0%] [-34.50dB] [off]
Simple mixer control 'Headset Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 3 [100%] [30.00dB]
  Front Right: 3 [100%] [30.00dB]
Simple mixer control 'Internal Mic',0
  Capabilities: cswitch cswitch-joined cswitch-exclusive
  Capture exclusive group: 0
  Capture channels: Mono
  Mono: Capture [on]
Simple mixer control 'Internal Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 3 [100%] [36.00dB]
  Front Right: 3 [100%] [36.00dB]
5

You are running Pulseaudio, which uses ALSA to drive soundcards, but which connects to Bluetooth speakers without involving ALSA. When you set ALSA volumes with amixer, Pulseaudio notices and corrects the source/sink volumes (actually using a somewhat complicated algorithm, because ALSA volumes can be chanined), but not matter what you try, you won't be able to control Bluetooth speakers that way.

So just set the Pulseaudio volume directly. The command to do that is

pactl set-sink-volume name_of_bluetooth_speaker +3%

etc. You can see the names of all your sinks with

pacmd list-sinks | grep name:

Use the name without the angular brackets. There is no "master" volume.

You can also use scripts like this one which detects active sinks, and changes the volume on them.

  • Thank you very much, I get it now. I am looking why decreasing the volume is not working: pactl set-sink-volume bluez_sink.FC_A8_9A_CB_86_0D -3% pactl: invalid option -- '3' the link to the code seems to be doing the same thing – aless80 Jan 28 '17 at 17:40
  • It seems to interpret the - as an option character. Does +3% work? Does 3% work? What version of Pulseaudio is it? (my Debian package is 9.0-5). Possibly an older version that doesn't support relative percentages? What does man pactl on your system say about valid volume values? – dirkt Jan 28 '17 at 20:12
  • Yes, +3% works, 3% too (it sets the volume to only 3%). The manual says you can use a number, db, percentage, etc, and also + or -: >pactl --v pactl 4.0 Compiled with libpulse 4.0. > man pactl .. set-sink-volume SINK VOLUME Set the volume of the specified sink (identified by its symbolic name or numerical index). VOLUME can be specified as an integer (e.g. 2000, 16384), a linear factor (e.g. 0.4, 1.100), a percentage (e.g. 10%, 100%) or a decibel value (e.g. 0dB, 20dB). If the volume specification start with a + or - the volume adjustment will be relative to the current sink volume – aless80 Jan 29 '17 at 1:46
  • Also, according to the script you linked the currently active sink should be the one with an asterix. That seems to be always the same sink even when i am playing music on the bluetooth device: pacmd list-sinks >>> 3 sink(s) available. * index: 2 //THIS * IS NOT THE BLUETOOTH name: <alsa_output.pci-0000_00_1b.0.analog-stereo> ... – aless80 Jan 29 '17 at 1:46
  • If the manpage states that - works, I have no idea why it doesn't in your case. I haven't actually tested that script yet (but wanted to use it myself at some stage); it looks like it takes a shortcut and just gets the default sink (which is marked with *), instead of looking at the current volume via the monitor. Pity, guess I'll have to keep looking, or write my own. – dirkt Jan 29 '17 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.