0

I'm not sure if this is possible at all or if its not possible with the information that I currently have. If it's not possible please let me know. I'm not the best in math so searched on the internet but didn't find a suitable answer.

I'm building a USB device with receives information from Windows on the current volume setting and I would like to calculate that into a percentage. The issue that I'm facing is that the information received is not linear as it is notated in decibel.

I have the following information (raw and decibel):

  • lowest possible value: -1536 -> 0db (ie 0%)
  • highest possible value: 9216 -> 36db (ie 100%)
  • The received can never exceed these 2 values

since the lowest possible value is negative I increased all values (lowest, highest and incoming) with 1536 so that I wont have to deal with negatives. My latest attempt is close but not good. 98% in windows would calculate into 91% for me:

$(((receivedDB - dB_L) * 100) / (dB_M - dB_L))$

I'm not sure if this can help, but here are some values that Windows sends (from 100% to 90% (windows volume scale), windows jumps by 2%) these are corrected (increased by 1536):

  • 10752
  • 9814
  • 9814
  • 6891
  • 7884

To calculate the DB this formula is used $value * (1 / 256)$

wes
  • 101
  • Two comments/questions: 1) Do you know if your signal is linear in dB? and 2) the list of number at the bottom is not monotonic so it's not clear there's a nice relation shift between those number and the percentage, are the numbers in the list correct? – GrapefruitIsAwesome Jan 27 '22 at 01:21
  • @GrapefruitIsAwesome, im not completely sure what you are asking, but will do my best to answer it for you.
    1. I know that the values received can used to calculate the dB with the formula shown as mentioned by the USB foundation datasheets. By looking at it, its not linear
    2. The values are correct, but there is no nice shift in between values. I didnt want to post all the values as it will be a mess. Here is the full list: https://pastebin.com/SPhE3vvf. The first 3 0's can be seen as 0%, but the value 47 is 4% if that makes sense
    – wes Jan 27 '22 at 13:37

0 Answers0