Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

track volume sliders are not accurate

October 31 (8 years ago)

Edited October 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I've been working on a sound control API script and noticed something a little funny while I was implementing the volume control section of it. The volume sliders in the jukebox aren't accurate at all. The mid way point on the slider is equivalent to about 30% volume instead of 50%.

Slider at roughly half-way point (actually a bit to the right of center):

But has the below stats logged in the API console (from an on('change:jukeboxtrack') event):
{"_type":"jukeboxtrack","_id":"-KVFR1TNAPBCrpeRuyuM","playing":false,"softstop":false,"title":"Test-players-","loop":false,"volume":30.250000000000004}

Moving the slider all the way to the right, does result in the volume being set to 100:
{"_type":"jukeboxtrack","_id":"-KVFR1TNAPBCrpeRuyuM","playing":false,"softstop":false,"title":"Test-players-","loop":false,"volume":100}

Slider at 50% (set via Script) for comparison:
October 31 (8 years ago)
Gold
Forum Champion
The thread is good as a report just to let the Devs know of your findings. Thanks, Scott.

I think that the intent of the default volume setting is to allow some overhead for voices, while also giving the GM control to move a range of up or down. From your research it looks like the increase is graduated, like a parabola, not a linear progression; volume sliders are often set up this way. This seems like intended behavior of the jukebox feature rather than a bug. Are there any issues from this in your games that you would like to resolve with troubleshooting? 

https://wiki.roll20.net/Jukebox#Volume_Slider

October 31 (8 years ago)

Edited October 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
Huh, didn't know that volume sliders were supposed to be setup that way; they haven't been in any application I have used before (e.g. netflix, youtube, windows volume control) - these obviously aren't professional soundmixers, but then again Roll20 isn't either. Makes it difficult to set a track's volume at higher levels as a slight shift to the right can mean the difference between 75% volume and 90% volume, which are quite different in terms of mixing with a party's voices and/or other music. It's also visually jarring if you don't know about it before hand.
October 31 (8 years ago)
Gold
Forum Champion
I follow you. Good points. Have you found sounds that need to be turned UP from the default setting, when voices are mixed? For me it would only be a very quiet sound file (I haven't found any yet) that would normally be turned UP from the default if you have voices; or in a non-voices case, turning up the jukebox sounds to emphasize the soundtrack with no voice overlap. There is also Master Volume for each individual (in Roll20 under settings icon), and there is also computer volume for each computer (or headphones. or speakers). With all these different volumes multiplying each other, I think the Jukebox is meant to have default settings that should't blow anyone's eardrums or speakers when the sound starts.

I perceive the gradation as roughly like Volume 0, 1, 2, 3, 4, though it is actually more discrete than that (0-100).  All the way down is silent. All the way up is max. The default is an amount in the middle that tends to work with voices, and Scott's finding was that the default is more like 30/100 than 50/100. You can choose an intermediate amount that is quieter ('This sound is too loud with our voices'), or a setting that is louder without going max ('Turn up the music a bit').  In consideration of all the other volume controls that factor in to what each person is actually hearing (computer settings, Master volume Roll20, and the sound level of the sound file itself), I find the difference between 75% and 90% on the high end or 10% to 25% on the low end is rather airy. Not saying there isn't a mathematical and perceptual difference, but, within the narrow ranges on either side, the actual computers/speakers/headphones are going to be putting out different decibles (dB) as it is.

I understand your aim to get it right, and to know a precise percentage setting (especially if you're setting up a new sound API). Someone else may come along to this thread with a different answer.
October 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
I mean it's not a problem for the script as I'm just gonna use linear progression of the volumes, but thought I'd pass it on to the devs.
October 31 (8 years ago)
The Aaron
Pro
API Scripter
It's probably a function of the decibel scale being logarithmic. Likely the sound system reports the volume in decibels and the slider attempts to scale it linearly.
October 31 (8 years ago)
The sliders are horrible to work with. Half the time they don't want to change.
October 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

SkyCaptainXIII said:

The sliders are horrible to work with. Half the time they don't want to change.

I'm aiming to fix this ;)
October 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator

The Aaron said:

It's probably a function of the decibel scale being logarithmic. Likely the sound system reports the volume in decibels and the slider attempts to scale it linearly.

The only problem with this is that the slider's unit is percentage, which is not log scaled. There's no guarantee that moving from any given percentage to any other will move the decibels of a given track into a new order of magnitude and so percentage should be on a linear scale regardless of what the percentage is referring to.
October 31 (8 years ago)
Riley D.
Roll20 Team
You can use this formula to figure out what the slider value should be set to for a given "volume percentage":

Math.pow(newvol / 100, 2) * 100

We probably should have just stored the raw slider value and the do the logrimithic scaling later on, but then again I wrote that code like 4 years ago so there you go :-)

Hope that helps.
October 31 (8 years ago)
Scott C.
Forum Champion
Sheet Author
API Scripter
Compendium Curator
hmm, there's something funky about that equation I think. Assuming I'm understanding math.pow correctly, that would be the javascript equivalent of:
((X/100)^2)*100

But if you put say 50 in as X, that gives you 25 as the volume slider position, which is the opposite side of the slider from where 50% actually is located (assuming that the "volume" logged in the API console above is what should be put in for X). I'm basing the orientation of the bar on the fact that putting 100 in for X gives 100, and so assuming that the slider is 0 on the left and 100 on the right (which is also how it is described in the wiki).

Shouldn't matter for the script tho, as I'm just setting the volume to whatever the user enters percentage wise (0-100), which then sets the slider to the position accordingly.