Req Volume step size setting
#1
The volume step size (the amount the volume changes by when you press volume up or down) is much too small when using a remote with slow key repeat; it makes it take forever to change the volume. You can change the step size with a custom keyboard.xml and python script (I have my volume step set to 5x the default), but it would be nice if there was a setting in the GUI for this.

If anyone's interested, I've included my current config below.

volume.py:

Code:
import json, sys, xbmc
step = 5
if sys.argv[1] == 'down':
    step *= -1
rpc = '{"jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["volume"]}, "id": 1}'
vol = json.loads(xbmc.executeJSONRPC(rpc))["result"]["volume"]
xbmc.executebuiltin('SetVolume(%d,showVolumeBar)' % (vol + step))

keyboard.xml:

Code:
<keymap>
  <global>
    <keyboard>
      <volume_up>RunScript("/path/to/volume.py", "up")</volume_up>
      <volume_down>RunScript("/path/to/volume.py", "down")</volume_down>
    </keyboard>
  </global>
</keymap>

Edit: on Linux, there's a faster way to do it, see this post.
Reply
#2
I like it, but I think it would need to be in some specific remote-control setting to not clutter things up. However, I think the best chance of something like this being added is something like some kind of GUI settings hook for add-ons. The add-on would say "slip me into this screen for this setting", and it will show up along side normal settings. Maybe marked in a way so you know it's an add-on setting, or maybe in a logical sub-section, etc. Maybe even have a settings level to hide add-on settings, incase things get too cluttered.

There's a lot of add-ons, like your example, where this would make a ton of sense. Another one would be something like Unpause Jump Back, or the Language Preferences add-on for subs and audio.

Either way, however the devs decide to implement such a thing, thanks for posting the python code for how to do this.
Reply
#3
Personally I think that bumping the default is valid. I've often though it was way to low Smile
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#4
Thank you for the code. I have the same problem with my remote.
I would not take a factor of five, though, possibly something like 2 or 3, but that's of course a matter of personal preference.

Another related issue is that the volume bar disappears too quickly, often it's gone before I can press the button second time. It does not impair the functionality, but the permanent blinking is not nice. The display time does not seem to be customizable at the moment, at least I could not find it in the normal or advanced settings. If not, it would be nice to have it added (I think the advanced settings would be the right place).
Reply
#5
Personally I think 5 is way too low, I'm assuming this works out like 100% / 5 = 20, so 20 steps of volume, correct?

I've used XBMC for years, on horrible quality built in TV speakers and very high end home theater equipment.

In both scenarios the differences between say volume 7 and volume 8 IS TOO MUCH.

I'm wondering if they changed it recently, because at the moment I count only TEN levels of volume, so each step is quite louder or quieter than the last. - EDIT I realize now that I actually count about 85 steps using the +/- controls on my keyboard, but upon changing the volume using Yatse remote on Android, there is only ten. This might be fault of the developer of Yatse but I swear I had this same issue using the official remote as well. [end edit]

It works out so badly that on both aforementioned systems, I need more steps because ... step 8 is much too loud and step 7 is too quiet, to the point that it seriously annoys and bothers me and I have to use Windows volume control as well, which is seriously besides the point and not efficient..

I've had to get up and manually reduce/increase the volume on Windows in order to get a comfortable volume level, many times. It's frustrating and a feature that should be included in the GUI.

OP: I tried your posted settings, I have the files made and named correctly in the XBMC userdata folder.

I have almost no experience with coding beyond simple editing of someone else's code, basically simple things like what you posted and I'm trying to use. I have experience editing .xml files and that's about it.

Except it won't work, is there something I have to edit in the volume.py code to make it work correctly? This is my lack of programming knowledge because I can't make much sense of the syntax.

I did correctly edit the keyboard.xml file to the path where volume.py is located, as such:

<keymap>
<global>
<keyboard>
<volume_up>RunScript("C:\Users\23\AppData\Roaming\XBMC\userdata\volume.py", "up")</volume_up>
<volume_down>RunScript("C:\Users\23\AppData\Roaming\XBMC\userdata\volume.py", "down")</volume_down>
</keyboard>
</global>
</keymap>


Is this correct? I feel there is something I'm doing wrong due to my lack of knowledge, I did everything you said to do and I have python 3.4 installed.

Thank you for any assistance, as I greatly appreciate it Smile

And thanks to the Kodi team for a great product and here's hope they will introduce this as a feature very soon because it's one of my biggest gripes with XBMC/Kodi and I've been using it for at least five years now.
Reply
#6
Ubel:

The code will only work for a keyboard or infrared remote, sorry! (To answer your other question, yes, the volume is reported out of 100, so you get about twenty steps, although it's easy enough to change.)

Remote apps like Yatse are completely different; they talk directly to the Kodi API, so they make their own choice of volume step. If you'd like to change it, I think you'd have to talk to the developers of the remote app.
Reply
#7
did not really work for me ... i use a logitech k400 wireless keyboard , this is my debug log :

http://xbmclogs.com/show.php?id=363759

my script
/home/atreyu/SOURCE-CODE/XBMC-VOLUME.PY
import json, sys, xbmc
step = 20
if sys.argv[1] == 'down':
step *= -1
rpc = '{"jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["volume"]}, "id": 1}'
vol = json.loads(xbmc.executeJSONRPC(rpc))["result"]["volume"]
xbmc.executebuiltin('SetVolume(%d,showVolumeBar)' % (vol + step))

my keyboard xml:
/home/atreyu/.xbmc/userdata/keyboard.xml
<keymap>
<global>
<keyboard>
<volume_up>RunScript("/home/atreyu/SOURCE-CODE/XBMC-VOLUME.PY", "up")</volume_up>
<volume_down>RunScript("/home/atreyu/SOURCE-CODE/XBMC-VOLUME.PY", "down")</volume_down>
</keyboard>
</global>
</keymap>
Reply
#8
solved, had put the xml in the wrong place, the right place is:

/home/atreyu/.xbmc/userdata/keymaps

works like a charm !! many thanks !!
Reply
#9
(2014-11-10, 09:28)kybos Wrote: Thank you for the code. I have the same problem with my remote.
I would not take a factor of five, though, possibly something like 2 or 3, but that's of course a matter of personal preference.

Another related issue is that the volume bar disappears too quickly, often it's gone before I can press the button second time. It does not impair the functionality, but the permanent blinking is not nice. The display time does not seem to be customizable at the moment, at least I could not find it in the normal or advanced settings. If not, it would be nice to have it added (I think the advanced settings would be the right place).

This can be changed by editing the skin file DialogVolumeBar.xml. Near the top of the file, you will see something like following:

Code:
<animation effect="slide" start="0,0" end="0,-40" delay="400" time="100">WindowClose</animation>

..where the delay value is in milliseconds. Increase this value (to 1000 for 1 second, for example).
Anti-Fascist◾Artist◾Atheist◾Barefoot◾Cis-male◾Cyclist◾Gay◾Geeky◾Introverted◾Likes weird stuff◾Living with depression & anxiety◾Naturist◾Pierced◾Socialist◾He/him
Reply
#10
Thanks for the hint!
Reply
#11
Would be great if there would be an officially integrated solution to modify the step size in the future.
The code above works, unfortunately it takes quite long to execute on slower systems.
Reply
#12
--
Reply
#13
Hi I followed instructions and scripted the two files as below in Directory C:\Users\username\AppData\Roaming\Kodi\userdata\keymaps
But it does not do anything. The volume increments in kodi stay the same. I am using Kodi V14.2. Please help and advise me on what I have done wrong

File 1 is volume.py

import json, sys, xbmc
step = 5
if sys.argv[1] == 'down':
step *= -1
rpc = '{"jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["volume"]}, "id": 1}'
vol = json.loads(xbmc.executeJSONRPC(rpc))["result"]["volume"]
xbmc.executebuiltin('SetVolume(%d,showVolumeBar)' % (vol + step))

file 2 is keyboard.xml

<keymap>
<global>
<keyboard>
<volume_up>RunScript("C:\Users\username\AppData\Roaming\Kodi\userdata\keymaps\volume.py", "up")</volume_up>
<volume_down>RunScript("C:\Users\username\AppData\Roaming\Kodi\userdata\keymaps\volume.py", "down")</volume_down>
</keyboard>
</global>
</keymap>
Reply
#14
Bump. Can anybody help me please?
Reply
#15
interested too, tried in windows but it doesn't work

checked the path and it's ok (copy/paste the path in windows explorer)

<keymap>
<global>
<keyboard>
<volume_up>RunScript("C:\Utenti\Roby\AppData\Roaming\kodi\userdata\volume.py", "up")</volume_up>
<volume_down>RunScript("C:\Utenti\Roby\AppData\Roaming\kodi\userdata\volume.py", "down")</volume_down>
</keyboard>
</global>
</keymap>
Reply

Logout Mark Read Team Forum Stats Members Help
Volume step size setting0