1

I've seen 20*Log10(amplitude) as the proper way to calculate dB, where 0 < amplitude <= 1. (So, to get amplitude when signed integer data types are used to represent amplitudes, you use value/maxvalue for positive values and value/minvalue for negative values.)

I know this formula generates 0 for extreme values and negative numbers for everything else. I also know it's showing a relationship between the sample and an extreme sample value. Is this properly called dBu or dBv or something else? I've seen both, plus just "dB".

I didn't study electrical engineering, so as close as you can get to a layman's explanation of why a particular unit is correct would also be helpful.

trw
  • 111
  • 2
  • Your input doesn't have to be less than one. It rarely is, in fact. dBu means dB over micro(volts/amps/etc, whichever is relevant; dBμV would be less ambiguous), dBV is dB over volts, etc. – Hearth Feb 06 '19 at 17:04

2 Answers2

2

Your confusion seems to be related to not understanding exactly how decibel measurements work. You say \$20·\log_{10}(amplitude)\$, but this isn't quite correct.

The proper formula is \$20·\log_{10}(\frac{amplitude}{reference})\$, where \$reference\$ is your reference value. The choice of reference value is what determines the full symbol used; if \$reference = 1\mathrm{μV}\$, for example, then the unit would be written as dBμV or dBuV. Likewise, with a millivolt reference, you would write it as dBmV. Current quantities are also written this way, dBμA for example.

Note that the formula is different when dealing with power quantities. With a power measurement, you use \$10·\log_{10}(\frac{amplitude}{reference})\$. The reason 10 is used instead of 20 here is because of the quadratic relationship between power and voltage or power and current.

Hearth
  • 32,466
  • 3
  • 55
  • 133
  • 2
    I think that the OP's question boils down to "what reference is used in DSP" -- and I haven't seen one used at all. You see dBm (reference = 1mW), dB$\mu$, dBV, dBA -- but I haven't seen dB(lsb) or dB(full range). It tends to make me think that it's not such a useful quantity, or the community would have invented it out of necessity. – TimWescott Feb 06 '19 at 17:24
  • 3
    Yes, I'm definitely confused. You might be overgeneralizing the answer, though. The application is a digital audio recording, so the signal voltage of the original analog audio is long gone. All I have is a bunch of integers from -32768 to 32767 (for a 16-bit samples). A lot of audio software tells you how many dB a peak is from 0. The value is always zero or negative because 0 dB represents the loudest recordable amplitude. I think I see that the reference is the loudest recordable amplitude. I'm still confused as to what type of dB unit (if any) is appropriate. – trw Feb 06 '19 at 17:24
  • @TimWescott Ah, if they're asking about a very specific subfield, I won't be able to answer then. I have essentially no background in DSP work. – Hearth Feb 06 '19 at 17:27
  • 2
    Without a conversion factor to calculate voltage from the sample values, all you can do is use "dBFS" - that's "decibels relative to full scale." – JRE Feb 06 '19 at 18:02
  • I'd go with dBfs, except if it's established practice to just use "dB" with no qualifier, then you're going to engender confusion by tacking on the units that should be there anyway. – TimWescott Feb 06 '19 at 18:43
  • Established practise here is DbFS, at least for a digital peak reading instrument, or a true peak meter (which can actually go at least 3dB ABOVE 0DbFS (And much higher then that on a pathological). Sample value generally maps to voltage so 20 log is appropriate as the dB is a power ratio. – Dan Mills Feb 06 '19 at 20:50
  • You seem to be formatting it wrong; should it be dBfs or dBFS? I'm quite sure it's not DbFS. – Hearth Feb 06 '19 at 20:53
2

Based on your comments it sounds like you are calculating dB levels with a reference level of full scale (an integer value of 32767 in your case).

According to NIST Pub 811 section 8.7, you should always write the value with a subscript to indicate what kind of quantity you are measuring and explicitly include the reference level. So, if you were talking about a ratio of voltages you might say

$$ L_V (re full scale) = -6\,\mathrm{dB} \quad\text{ or }\quad L_{V(full scale)} = -6\,\mathrm{dB} $$

Elliot Alderson
  • 31,521
  • 5
  • 30
  • 67