Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Converting 16-bit values to dB (Read 4045 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Converting 16-bit values to dB

Hello,

Does anyone know the proper way to get decibels from a 16-bit value?

I'm not sure if these assumptions are correct:
0x0000 = 0 dB
0xFFFF = 96 dB
0x???? = 48 dB

If anyone has more information on this, I'd love to hear it.

Thanks

Converting 16-bit values to dB

Reply #1
dB means different things to different people. I assume you mean something like dBFS.

the definition should be something like

db =
20*log10(X/0xFFFF)

If 0xFFFF is full scale.

0xffff = 0db
0x7fff ~= -6db
0x3fff ~= -12db
...
0x0000 = -Inf

Converting 16-bit values to dB

Reply #2
You might want to replace 0xFFFF with 0x8000.
0x8000 or 0x8000-1 can be considered "full scale" for 16 bit signed values.
be sure to pass only positive values to log10() then -- ie max(abs(signal)) for peaks

 

Converting 16-bit values to dB

Reply #3
Thanks Axon and Sebastian.  In this case the value is unsigned, although you're right, typically it's signed.

I may need to follow up on this later, not 100% sure I got it