ΣSigmaStudio Ask AI Русский Log in

Single volume gain math

SigmaDSP & SigmaStudio Semi_Tehrani Oct 10, 2018 00:00 4 replies Original on forum ↗
Subscribe
Semi_Tehrani Question
Oct 10, 2018 00:00

Hello,

I used the "Single Volume " for user gain. The user should be able to adjust the gain through our GUI.

It would be great if you let me know how to do the conversion from dB to "value" and to "hex". The value for 0 dBu is "1" as it shown in the data captured window.

Range is 0 to - 80 dB currently.

Would the conversion be different for negative and positive gains?

Thanks, Semi

David <David.Thibodeau@analog.com>

Thibodeau

KJBob Reply
Oct 10, 2018 00:00

Hello,

The conversion from dB to linear gain (for both positive and negative dB):

G = 10 ^ (dB/20)

To convert the linear gain to an integer (32.0 format) variable, multiply by (2^24) which is 16777216.

Example: -20 dB G = 10 ^ (-20/20) = 10 ^ (-1) = 0.1

Integer value = 0.1 * 16777216 = 1677722 base 10, equal to hex 19 99 9A -- the same as the Capture Window shows for -20 dB.

Inside your microcontroller you'll have the binary value stored as a long integer, you just need to break this 32 bit word into four 8-bit bytes for safeloading. My C compiler has a "make8" function for this purpose.

Best regards,

Bob

Semi_Tehrani Reply
Oct 11, 2018 00:00

Thank you Semi

przemekw Reply
Oct 10, 2020 00:00

Hello Bob,

I think we should use 8388608 instead of 16777216.

Integer value=0,1 * 8388608 = 838861 (B10), hex C CC CC.

C CC CD I see at the Data capture window.

For 0 dB we have 1 * 8388608 and it is equal to 80 00 00 hex.

Regards,

Przemek

KJBob Reply
Oct 10, 2020 00:00

Hello Przemek,

You are correct, the multiplier for the Sigma 100 / 200 chips using the 5.23 number format is 8388608. Although the original post does not mention the particular SigmaDSP in use, it appears I had figured the calculation for the Sigma 300 / 350 chips like the ADAU1452. These use a 8.24 number format -- thus the multiplier is twice what you have found for chips using the 5.23 format. We can observe the difference below, where I cut and pasted the ADAU1701's -20dB setting below that of the ADAU1452 to save space.

Thank you for bringing this up as it clarifies the difference between Sigma 100/200 and Sigma 300+ chips.

Best regards,

Bob

1452-Vol.png
1452-Vol.png