I am working in an engine that encodes sound as decibels (dB). Let's assume the decibel range of human hearing is -60dB to 0dB.

Audibility is not linear across this range.

So my question is...

How does one map a decibel range to a set of numbers (for example, 1-10), such that each number corresponds to (roughly) one linear step up in audibility?

  • \$\begingroup\$ I have updated my answer. I hope it helps. \$\endgroup\$ – Vaillancourt Dec 6 '19 at 16:21
  • \$\begingroup\$ Are you asking simply for a mathematical formula to convert a number from (1, 10) to (-60, 0)? \$\endgroup\$ – TomTsagk Dec 6 '19 at 16:23
  • \$\begingroup\$ @TomTsagk, no. That would help if audibility was linear across (-60, 0) dB, but it is not. \$\endgroup\$ – GrimGrom Dec 7 '19 at 5:39

We use dBvalue = 20 * log10( volumeAsPercent ) where volumeAsPercent is in the range of [0.001 .. 1]. dbValue will be in the range of [-60 .. 0].

(That's a bit annoying because the actual engine - OpenAL - uses 0..1 for its gain, so we have to convert that back using volumeAsPercent = 2^(dBvalue/6). It will not exactly give the same result as the input but will give an approximation to volumeAsPercent = 10^(dBvalue/20) which is close enough (I don't know why we use that formula, and we can't change it at this point).)

I'm not a sound engineer, I don't play music and I don't have a sound studio to test this, but testing this formula with increments of 10%, seems to give a nice progression in making the sound louder (from completely muted at 0, up to what is in the original wav file at 1).

Here are the plotted curves.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.