Support and General Use > Theming and Appearance Customization

Volume percent

(1/3) > >>

Logg:
This is what I have right now:


--- Code: ---%?pv<0.0|1.5|3.1|4.6|6.2|7.7|9.2|10.8|12.3|13.8|15.4|16.9|18.5|20.0|21.5|23.1|24.6|26.2|27.7|29.2|30.8|32.3|33.8|35.4|36.9|38.5|40.0|41.5|43.1|44.6|46.2|47.7|49.2|50.8|52.3|53.8|55.4|56.9|58.5|60.0|61.5|63.1|64.6|66.2|67.7|69.2|70.8|72.3|73.8|75.4|76.9|78.5|80.0|81.5|83.1|84.6|86.2|87.7|89.2|90.8|Way Too Loud>%%
--- End code ---

Which works great, except it will only work if there are 58 places below 0dB and 6 above and I can't display percentages for decibels greater than zero. Is there a better way to do this?

In attempt to comply with forum rule 5.5, I am including this next block.
Note to future: This post written November 19th, 2009; Rockbox 3.4 was the latest build.  If answer here is no, it's possible that the answer is now yes. If the answer is still no, and you found this page while looking for the same solution and there are not 58 places below 0db and 6 above; then you can generate an appropriate list with this python 2.6 script:
--- Code: ---def percent():
    x=0
    g=0
    string=""
    while g<=59: #change 59 to your amount below 1dB
        string=string+str(round(x,1))+"|"
        x=x+100.0/65.0 #change the denominator here to total amount of possible volume settings
        g+=1
    print string #If you're in python 3, print statement is now a function
percent()
--- End code ---

Llorean:
You wouldn't want to go above 0 anyway. >0dB means that you'll get clipping, among other things.

There is not a better way to do this, and honestly "percentage" doesn't make a whole lot of sense. Volume counts down from the level the file is recorded at, where yours says 40.0%, that's not a percentage *of* anything. It's just a made up number you're using.

Logg:
It's a percentage of maximum possible volume, and while you would never want to go above 0dB since it would likely damage the headphones, it seems wrong to leave it as is.

saratoga:

--- Quote from: Logg on November 19, 2009, 08:31:51 PM ---It's a percentage of maximum possible volume,

--- End quote ---

Actually no, at least not the way you're doing it.  dB are a logarithmic scale, so " x=x+100.0/65.0" is definitely not giving you percent of the maximum. If you want to do percentage of the maximum, -10dB is 10%, -20dB is 1%, -30dB 0.1% and so on. 

Llorean:
Volume counts down. One one player 0dB is 74 units from the minimum. On another it's 58. On some you can go above 0db, on others you cannot.

Why use "percentage" if it's just making up things? Why not just reverse the scale so that it counts from 0 up to 58? Percentage offers no useful information at all, you're just making up a pretend scale to use instead of a real scale.

Navigation

[0] Message Index

[#] Next page

Go to full version