When I press the volume up/down keys on my keyboard, the volume changes too much. How can I make the step size smaller so that I have finer control?
When I press the volume up/down keys on my keyboard, the volume changes too much. How can I make the step size smaller so that I have finer control?
Ubuntu 17.10 and later
It's worth noting that on Ubuntu 17.10 and later with GNOME Shell, there is already (albeit somewhat convoluted) kind of support for this.
Press Shift+XF86AudioRaiseVolume or Shift+XF86AudioLowerVolume (usually the dedicated volume up / down keys on the keyboard) to change the volume with a smaller step size.
Ubuntu 14.04 / 15.04 / 15.10 / 16.04 / 16.10 / 17.04
I finally have a proper solution for Trusty, Vivid, Wily, Xenial, Yakkety, and Zesty users. Rather than using a bunch of hacks or a script, I decided to fix the problem in the source code. I applied this patch (now broken) to gnome-settings-daemon and unity-settings-daemon (some trivial modifications were made to the patch).
I have uploaded the packages to a PPA:
Once you've added the PPA, run:
You will need to restart after installation completes. Once the packages have been upgraded, you can use the
dconf
command to change the volume increment:(The default value is 6.)
Now when you press the volume keys, the volume will change in increments of 2:
11.10/12.04
From this bug-report it appears the volume-step key disappeared in 11.10 and has not (as yet) reappeared.
Thus, there isn't a simple straightforward configuration change that you can make to reduce the volume step.
Post #18 in the link gives an interesting workaround which involves using
alsamixer
increment and decrement capability together with sending notifications to the desktop.However I couldn't get it to work - thus my take on the solution is based upon that post.
With this solution, the default volume step will be reduced to two-percent steps.
How to
Install the
xbindkeys
package (using Synaptic, or withsudo apt-get install xbindkeys
).Using your favourite text editor, create a file in your home folder called
.volumeHack.sh
and copy and paste the contents below into that file i.e.Run
chmod a+x .volumeHack.sh
to make it executable.Then edit the file
~/.xbindkeysrc
and copy & paste the text below at the bottom of this file. i.e.Logout and login
.xbindkeysrc
.volumeHack.sh
10.04/10.10/11.04
I just discovered that
gconf-editor
has a setting for "Volume step as percentage of volume":/apps/gnome_settings_daemon/volume_step
Much more elegant, and it works with the OSD volume notifications.
This easy solution works for (at least) 12.04 and does not require CCSM.
You will not have on-screen volume bar action when you use the keyboard shortcuts, but you will have however fine-grained volume control as you wish.
System Settings > Keyboard > "Shortcuts" tab > "Sound and Media" category
Disable the existing "Volume Down" and "Volume Up" shortcuts. To do this, on each one click to select it and then press Backspace to clear any key combo associated with it.
Now select the "Custom Shortcuts" category and click the "+" icon to create two new shortcuts as follows:
(Experiment with the percentages. If you need to go extremely fine then omit the % sign and it will use a 0-255 scale rather than percent).
Now assign each of your new shortcuts to a key or key combo: Select a shortcut and type the desired key or keys on your keyboard.
After this, when you use your keyboard volume controls you should have whatever volume increments you specified. You can always go back to the original behavior by disabling your custom shortcuts and re-enabling the premade ones in the "Sound and Media" category.
You can do this with CompizConfig Settings Manager. Use the command
sudo apt-get install compizconfig-settings-manager
if you haven't installed it already.Now open the CompizConfig Settings Manager and go to Commands in the General section. Check the Enable commands checkbox to the right. In the Commands tab, enter the following two commands separately as two commands:
amixer set Master 5%+ -q
amixer set Master 5%- -q
Assign two keyboard shortcuts for the commands in the Key bindings tab. I use the Super+[ and Super+] combination. Now close the CompizConfig Settings Manager and this should work.
I'm not sure if you can assign the commands to the in-built volume controllers of the computer though.
12.04 (and possibly 11.10)
If you want to control the pulseaudio volume directly rather than go the ALSA route, you can use the following script. While it should also be possible to control the volume via DBUS as detailed in this Stackoverflow answer, I however could not find a way to make this work in Ubuntu 12.04.
As is said in the script itself, it uses this Stackoverflow answer on how to programmatically change volume in Ubuntu and expands the idea into a script which takes the volume change as a command line argument and also shows an OSD notification. I have tried to model it as closely as possible to the default Ubuntu (12.04) behavior.
The script takes volume changes as either an absolute or relative number or percent value. So for instance:
pavol.sh 2000
sets the volume to 2000,pavol.sh 30%
sets the volume to 30 percent,pavol.sh +1000
increases the volume by 1000 andpavol.sh -5%
decreases the volume by 5 percent.It is also quite liberally commented in the hopes that it is useful for further tweaking.
HowTo
Use your favorite text editor to create a file in your home folder (or anywhere else really - just remember the path) called
pavol.sh
and copy and paste the contents below into that file, i.e.Run
chmod a+x ~/pavol.sh
to make it executable.Then open
Sytem Settings
, go to theKeyboard
settings and switch to theShortcuts
tab. There click onCustom Shortcuts
and create two new keyboard shortcuts with the plus button.Give each one a name and as command enter something like this:
/home/username/pavol.sh "+3%"
It is important to enter the full path to thepavol.sh
script (unless the script lies in a folder that is included in the PATH environment variable). Also use quote signs""
around the volume value or the keyboard shortcut will not work.After that click on the right side of each entry to set a key combination or multimedia key. If the desired combination or key is already assigned to another shortcut, the program will ask if you want to reassign it.
pavol.sh
It's finally there!
Kubuntu 17.04
Edit the file
main.xml
typically found at:/usr/share/plasma/plasmoids/org.kde.plasma.volume/contents/config/main.xml
as root.Look for the volumeStep entry:
and change the percentage-per-step to whatever you want. I use 2% as you can see.
As written at Kubuntu 16.04, you'll need to restart Plasma for this to take effect:
On Gnome 3.36 (Ubuntu 20.04 LTS) the settings for increment is available here in dconf-editor
Set:
Get: