Live data from Hacker News

The scientific “unit” we call the decibel

lcamtuf.substack.com

221–230 of 511 posts

Re: The scientific “unit” we call the decibel

#221

It's a bit like hating numbers, and saying "What do you mean by 'three'; what is it - three volts, three amps, three metres? Clearly 'three' is meaningless, and we should stop using it and all the other numbers besides." decibels are simply a dimensionless ratio, used as a multiplier for some known value of some known quantity. In every context where decibels are used, either the unit they qualify is explicitly speci…

To be frank, your comment just reads to me as a "stockholm syndrome" type reaction to a needlessly complex unit that you're intimately familiar with. You see the same in HN threads where people complain that eg Git or Rust are needlessly complex, there's a swath of people who are so emotionally invested in how well they understand the ins and outs of Git resp Rust that any suggestion that maybe things could be better…

> As an example, it makes no sense to me that eg in audio software, volume sliders start at 0 dB and then go down to negative $MUCHO, until complete silence at -Infinity.

This one doesn’t bother me. Those sliders, and especially the real analog sliders they’re modeled after, don’t have an absolute scale — they are attenuators that reduce voltage. So 0dB is the same as no slider at all, -20dB reduces voltage by a factor of 10, etc.

Re: The scientific “unit” we call the decibel

#222
post #3

While the author is technically right, I must argue that in the area of sound work, decibels make sense. Zero is base level, -3db is half loudness, +3dB is double. There may be a better way to describe loudness, but decibel is good enough.

So on my amplifier, 0db is the loudest and -50db, where I usually listen is what? -47db is definitely not twice as loud as -50db, of course.

As someone else alluded to, 3dB is a doubling in power, not perceived loudness. 10dB will be perceived as a doubling in loudness. This is the original unit (the Bel, rather than deciBel) which was I believe derived by testing on human subjects to measure this.

TBH I don't agree with a lot of the article - yes, dB on its own only indicates a ratio, but certainly in the field I work with this is known, and there are qualifiers (dBA, dbFS dbU) which tie the ratio to a known value so you're talking about an absolute, known quantity - even the dBa which is mentioned as if it comes out of nowhere is something which most audio engineers know about and use regularly because it's important to know the difference betweent he signal present and perception of it by the listener.

Re: The scientific “unit” we call the decibel

#223
This is an incredibly valuable article for anyone who's trying to make sense of decibels in some context. Michał clearly explains almost all of the gotchas you have to understand.

I realized recently, after years of doing it for signal powers, that dB are a pretty convenient way to do mental logarithmic estimates for things that have nothing to do with power or signals, with only a small amount of memorization. Logarithms are great because they allow you to do multiplication with just addition, and mental addition isn't that hard. For example, if you want to know how many pixels are in a 3840×2160 4K display, well, log₁₀(3840) ≈ 3.58 (35.8dB-pixel) and log₁₀(2160) ≈ 3.33 (33.3dB-pixel), and 3.58 + 3.33 = 6.91 (69.1 dB-square-pixel), and 10⁶·⁹¹ ≈ 8.13 million. The correct number is 8.29 million, so the result is off by about 2%, which is precise enough for many purposes. (To be fair, though, 4000 × 2000 = 8000, which is only off by 3.5%.)

The great difficulty with logarithms is that you need a table of logarithms to use them, and a mental table of logarithms is a lot of rote memorization. You can get pretty decent results linearly interpolating between entries in a table of logarithms, so you can use a lot more logarithms than you know, but you have to know some.

It's pretty commonplace in EE work to make casual use of the fact that a factor of 2× [in power] is about 3 dB, which is a surprisingly good approximation (3.0103dB is a more precise number). This is related to the hacker commonplace that 2¹⁰ = 1024 ≈ 1000 = 10³; 1024× is 30.103dB, while 1000× is precisely 30dB.

To the extent that you're willing to accept this approximation, it allows you to easily derive several other numbers. 4× is 6dB, 8× is 9dB, 16× is 12dB, and therefore 1.6× is 2dB. ½× is -3dB, so 5× is 7dB (10-3). So with just 2× = 3.01dB we already know the base-10 logarithms of 1, 2, 4, 5, and 8, to fairly good precision. That's half of the most basic logarithm table. (The most imprecise of these is 8: 10⁰·⁹ is about 7.94, which is an error of about -0.7% when the right answer was 8.)

If we're willing to add a second magic number to our memorization, 3× ≈ 4.77dB. This allows us to derive 6× ≈ 7.78dB and 9× ≈ 9.54dB. So, with two magic numbers, we have fairly precise logarithms for 1, 2, 3, 4, 5, 6, 8, and 9.

The only multiplier digit we're missing is 7. (Shades of the Pentium's ×3 circuit: http://www.righto.com/2025/03/pentium-multiplier-adder-rever....) So a third magic number to memorize is that 7× ≈ 8.45dB. And now we can mentally approximate products and quotients with mentally interpolated logarithms.

You can do my example above of 3840×2160 as follows. 3.8 is 80% of the way from 3 (4.8dB) to 4 (6.0dB), so it's about 5.8dB. 2.2 is 20% of the way from 2 (3.0dB) to 3 (4.8dB), so about 3.4dB. 35.8dB + 33.4dB = 69.2dB, which is between 8 million (69.0dB) and 9 million (69.5dB), about 40% of the way, so our linear interpolation gives us 8.4 million. This result is high by 1.2%, which is much better than you'd expect from the crudity of the estimation process.

For a more difficult problem, what's the diameter of a round cable with 1.5 square centimeters of cross-sectional area? That's 150mm², half of 300mm², so 24.77 dB-square-millimeters minus 3.01, 21.76dB. A = πr². Divide by π by subtracting 5dB (okay, I guess that's a fourth magic number: log₁₀(π) ≈ 4.97dB) and you're at 16.76dB. Take the square root to get the radius by dividing that by 2: 8.38dB-millimeters. That's less than 7× ≈ 8.45dB by only 0.07dB, so 7-millimeter radius is a pretty decent approximation, 14mm diameter. The precise answer is closer to 13.82mm.

For approximating small corrections like that, it can be useful to keep in mind that ln(10) ≈ 2.303 (a fifth magic number to memorize), so every 1% of a dB (10¹·⁰⁰¹) is a change of about 0.23%. So that leftover 0.07dB meant that 7mm was high by a couple percent.

More crudely: 150mm² is 22dB, ÷π is 17dB, √ is 8½ (pace Fellini), 7×.

It's pretty common in engineering and scientific calculations like this to have a lot of factors to multiply and divide, increasing the number of additions and subtractions relative to the number of logarithmic conversions; this is why slide rules were so popular. Maybe you derived the 1.5cm² number from copper's conductivity and a resistance bound, or from the yield strength of a steel and a load, say. 3840×2160 pixels × 4 bytes/pixel / (10.8 gigabytes/second), as I was calculating last night in https://news.ycombinator.com/item?id=44056923? That's just 35.8 dB + 33.3dB + 6dB - 100.3dB = -25.2dB-seconds, which is 3.0 milliseconds to memcpy that 4K framebuffer. (I didn't do that mentally, though.) Even 36 + 33 + 6 - 100 = -25, so π ms, is a fine approximation if what you want to know is mostly whether it's more or less than 16.7 ms.

So here's a full list of the seven magic numbers to memorize for these purposes:

  2× ≈ 3.01dB (∴ 4×, 8×, 5×)
  3× ≈ 4.77dB (∴ 6×, 9×, 1.5×)
  7× ≈ 8.45dB
  π× ≈ 4.97dB
  ln(10) ≈ 2.303 (∴ 0.01dB ≈ 0.23%, etc.)
  1.259× ≈ 1dB (+1dB ≈ +25.9%)
  (1 - .206)× ≈ -1dB (-1dB ≈ -20.6%)
I haven't been applying this approach long; I'll try to report on results later.

Re: The scientific “unit” we call the decibel

#224

Earlier quoted context omitted.

Ratios are numbers. They are literally just fractions. No one argues that the numbers don't make sense because you can have different units. But that's what units are for – to know what does the preceding number refer to. Why have a unit that doesn't give you full information?

this if a TV seller went bonkers and only said "it's 10:16", can you guess the actual size of that TV?

But that's not what is being expressed. You might as well complain that the ratio doesn't give you information on the price, weight, or power usage of the TV.

Re: The scientific “unit” we call the decibel

#225

It's a bit like hating numbers, and saying "What do you mean by 'three'; what is it - three volts, three amps, three metres? Clearly 'three' is meaningless, and we should stop using it and all the other numbers besides." decibels are simply a dimensionless ratio, used as a multiplier for some known value of some known quantity. In every context where decibels are used, either the unit they qualify is explicitly speci…

To be frank, your comment just reads to me as a "stockholm syndrome" type reaction to a needlessly complex unit that you're intimately familiar with. You see the same in HN threads where people complain that eg Git or Rust are needlessly complex, there's a swath of people who are so emotionally invested in how well they understand the ins and outs of Git resp Rust that any suggestion that maybe things could be better…

dB is always relative, even when it appears to be an absolute unit. The 0 dB marking at the top of the volume slider on pro audio gear (more likely +3 or +6 or something similar to leave some headroom) means "0 dB relative to the maximum rated power level." In pro gear this will be an absolute industry standard of some sort, likely one where the load impedance is also defined. 1 milliwatt into 600 ohms or something like that. The distinction between voltage and power is always going to confuse people, but that's not the dB's fault.

A major reason decibels are used is to make it easy to assess the overall gain or loss of an entire chain of processing stages: you simply add the numbers. The equipment's output can only go down from 0 dB, so the rest of the scale is negative.

As for sound pressure levels in dB, those are given relative to a 0-dB point that corresponded originally to the faintest sound people were generally considered capable of perceiving. These days "0 dB" refers to a specific amount of acoustic power, which I don't know off the top of my head, and that might or might not be near the threshold of perception for a given listener. But the reasoning still applies: amplification or attenuation of power levels is a simple matter of addition when expressed in dB. Arbitrarily defining a system's reference level to be 100 dB instead of 0 dB would be of no use to anyone.

Re: The scientific “unit” we call the decibel

#226
post #190
post #148

Earlier quoted context omitted.

> Aspect ratio is a ratio. Right, but in this case they only give you one of the two numbers. Imagine being told that your TV had an aspect ration of ":16", and you just have to magically know what the other number means in the context. And sometimes ":16" actually means ":4", because quadratic mumble mumble, and sometimes the number is scaled according to some other "how big it seems to humans" factor; all of which…

Imagine being told that your TV had an aspect ration of ":16" We kind of have that with people talking about a screen or image being "2k" and then expect you to infer what the actual resolution and aspect ratio is from context.

Yes, and many of us find it silly :-)

Re: The scientific “unit” we call the decibel

#227
I'll summarize: It's annoying that dB is often used as a physical unit without the necessary suffix. It's annoying that the suffix seems quite random for most units It's annoying that the factor for power differs from the factor for voltage, etc. It's slightly annoying that it's usually decibel instead of Bel.

However, we all agree that dBs are really useful.

Re: The scientific “unit” we call the decibel

#228
post #24
post #3

While the author is technically right, I must argue that in the area of sound work, decibels make sense. Zero is base level, -3db is half loudness, +3dB is double. There may be a better way to describe loudness, but decibel is good enough.

> -3db is half loudness, +3dB is double It isn't tho. It's close but not exactly. And there's nothing about -3 behing half that makes sense except for familiarity (and it's not even wide-spread familiarity - most people wouldn't know how much louder +3dB is). It's just an unnecesarilly confusing definition that stuck for historic reasons.

> It isn't tho. It's close but not exactly.

It isn't tho :-). It's not close to double loudness. It's double power, which is 1.41 higher sound pressure, which is only slightly louder.

Re: The scientific “unit” we call the decibel

#229
post #208
post #190

Earlier quoted context omitted.

Imagine being told that your TV had an aspect ration of ":16" We kind of have that with people talking about a screen or image being "2k" and then expect you to infer what the actual resolution and aspect ratio is from context.

I think the difference is that if you write a blog post complaining about the silliness of these labels, you don't get people telling you that no, you don't get it, it's totally fine, these are just aspect ratios.

I remember a recent post about the ambiguous nature of a pixel, and extended to aspect rations, that garnered VERY similar responses to what you described.

Re: The scientific “unit” we call the decibel

#230
post #216
post #113

Earlier quoted context omitted.

The Bel is a unitless quantity. Yes, by convention, in certain fields, it applies to the logarithm of the ratio of powers. But in other fields (for example, quantifying a change in the degree of evidence for a hypothesis, as in Bayesian probability theory) it is applied to a ratio of different quantities (in the Bayesian case, a ratio of probabilities). There is no reason why dB can't be used for any unit, and its me…

The denominator isn't the issue. The context-dependent base of the logarithm is, which makes 1 Bel = 10x for some things and 1 Bel = 3.16x for others. I've never heard of decibels used in probability theory. Did they adopt it with the same baked-in bastardizations? Please tell me +10dB(stdev) = +10dB(variance) isn't a thing.

The problem stated in the article is that the unitless quantity of 1 Bel is effectively applied only to power ratios. It is of course true that one can transfer a scaling of powers into the base of the logarithm when we are trying to figure out what effective scaling of voltages corresponds to 1 Bel of power scaling, but it is ultimately more meaningful to state that a Bel is "only a scaling of power", which is a statement about the units of the two variables in the logarithm (but ultimately, once we know the denominator that belongs to the definition, the numerator is also known, so we only need to know the reference denominator).

In Bayesian probability theory, there is a quantity known as the "evidence". It is defined as e(D|H) = 10 * log_10 (O(D|H)), where O(D|H) is the odds of some data, D, given the hypothesis, H.

The odds are the ratio of the probability of the data given that the hypothesis H is true, over the probability of the data given that the hypothesis is false, or: O(D|H) = P(D|H)/P(D|NOT(H)).

Taking the logarithm of the odds allows us to add up terms instead of multiplying the probability ratios when we are dividing D into subsets; so we can construct systems that reason through additive increases or decreases in evidence, as new data "arrives" in some sequence.

The advantage of representing the evidence in dB is that we often deal with changes to odds that are difficult to represent in decimal, such as the difference between 1000:1 (probability of 0.999, or an evidence of 30dB) and 10000:1 (probability of 0.9999, or evidence of 40dB).

This use of evidence has been around at least since the 60s. For example, you can find it in Chapter 4 of "Probability Theory - The Logic of Science" by E.T. Jaynes.

Post reply on HN