I am writing a meter widget using a canvas, and you need to calculate the label values for the scale. No problem, except when I try to recreate the scale for the VU meter. I understand that it is logarithmic, but the values are not equal to 10 on this type of counter.
see: https://en.wikipedia.org/wiki/VU_meter
Function i has min and max values for the scale. For normal scales, a step between the values is also given. For example, if you set the value to -20 and 30 in increments of 10, it will create labels:
-20 -10 0 10 20 30
For the VU meter given -20 and 6, I need to create labels:
-20 -10 -5 -3 0 3 6
And the gap between these values does not match.
I am not asking for code examples, but instead of thinking about how to best implement this.
Do I have to write a function so that one of the parameters is a list of labels, and then draw them in a logarithmic scale? This does not work properly, because the numbers do not fall into the correct places, as shown in the image above the corresponding VU meter.
Is there any special formula for dB levels only that is not a simple log function?
Again, I am not asking for code examples, just for some help, to understand the best approach to use.
Thank!
source
share