# [music-dsp] Decibel Question

eli+ at gs211.sp.cs.cmu.edu eli+ at gs211.sp.cs.cmu.edu
Tue Apr 2 14:36:07 EST 2002

```Mike Suchoff wrote:
> 1. A voltage doubling results in a 6 dB change (i.e. 20*log(2) = 6).  But a
> power doubling results in a 3dB change (i.e. 10*log(2) = 3).

You presumably know that 20 log(2) = 6.0206... and are abbreviating,
but I want to point it out because I'd prefer not to have to deal with
code out there in the world that assumes this abbreviation is exact.

> 2. I don't know where this formula comes from (db = log10( 1.0 / _value ) /
> log10( 2 );).  I think the author found some algorithm using base 2 (i.e.
> log10(x) = log2(x)/log2(10) and misquoted it..  Also, the value being
> measured is always in the numerator and the standard is in the denominator.
> That is, when the measured value gets smaller, the dB value gets smaller.

Notice the next line of code: "db *= -6.0;".  So the formula is
-6 * log10(1/x) / log10(2)
= 6 * log10(x) / log10(2)           // for x != 0
= 19.93 * log10(x)
which is aiming at 20*log10(x).

--
Eli Brandt  |  eli+ at cs.cmu.edu  |  http://www.cs.cmu.edu/~eli/

dupswapdrop -- the music-dsp mailing list and website: subscription info,
FAQ, source code archive, list archive, book reviews, dsp links
http://shoko.calarts.edu/musicdsp/

```