# Decibels

## Recommended Posts

20 decibels is 10 times more than 10 decibels (10 = 10) 30 decibels is 100 times more than 10 decibels (10*10 = 100) 50 decibels is 10000 times more than 10 decibels (10*10*10*10 = 10000) Are these correct? Actually, I'm not sure if 50db is 10,000 times more than 10db or 100,000 times more. But 10,000 was the only one I could match math with, ha! Anyway, I'm going way off track. I guess the basic idea is that each 10db means 10x more. But how does this translate to single decibels? Or even hundreds of a decibel? My goal is actually to convert from percentages to decibels. I know that decibels are infinite, and so percentages are not possible. But I know the maximum decibel level of the value I'm computing. Does this change the situation? For sake of an example, let's just say that a certain stereo has a volume range of -30db (off), and up to 0db (full blast). Is there a way to calculate the volume's DB by knowing the percentage of the volume slider? I'm lost and appreciate any kind of insight [smile]

Yes.

From,
Nice coder

##### Share on other sites
Too insightful for me

edit..

Errr, wait a sec. Does this mean 11db is 2x more than 10db? 12db is 3x more than 10db? So 2db is 2x more than 1db, yet 3db is 2x more than 2db. This means each digit is raising by a power of 2, duh. Damn dude, you the man.

eh. no. That doesn't match up. If so 30 would be 20 times more than 10. Ack.

[Edited by - Jiia on March 27, 2005 2:05:34 AM]

##### Share on other sites

A link i scrounged.

##### Share on other sites
I really appeciate the link, but I've already scrounged more than I can stomach. Most of these sites are dealing with decibels in real life, rather than in a computerized scale.

I'm trying to convert a percentage of volume into a DirectSound decibel level. Strange how there are absolutely no threads to find about this. It's either very easy or no one even realizes the difference. Or perhaps everyone that uses DirectSound uses no other sound API, and works purely in decibels.

The most ironic thing about this is that DirectSound or the sound card is probably converting back to a percentage.

I'll try again later, my head hurts [sad]

##### Share on other sites
I spent the last half hour doing math. [sad]

10 = 1020 = 10030 = 100040 = 1000050 = 10000010^(x/10)if 10 m >= d >= nl(x) = 10^(x/10)c(x) = l(x)/c-z1 >= p >= 0c(m) >= p >= c(n)l(n) = zl(m)/c = 1+z10^(n/10) = zc10^(m/10) = c+zc10^(-30/10) = zc10^(0/10) = c+zc0.001 = zc1 = c+zc0.001 = zc1-c = zc0.999 = c0.001001 = zd = c-1(p)c(x) = l(x)/c-zyc+zc = 10^(x/10)log(8)/log(2)=c2^c = 810^(x/10) = yc+zcc-1(y) = 10log(yc+zc)d = c-1(p)d = 10log(p0.999+0.0001)0% = -4050% = 16.985363620195530146228016728609100% = 19.??????????????????????????????lol p = 50? should have been p = 0.5 mes stupid0% = -4050% = -3.0137757029790209753045731952852100% = -0.0039104102858294304456699375418313

Its not perfect but it looks like it will work ok.

(Note: If theres anything strange in my math just ignore it please. Its very late.)

edit: Maybe tomarrow I will make it work better. No promises tho.
And if you dont want to look through it all
decibels = 10*log10(percentage*0.999+0.0001)

##### Share on other sites
Quote:
 Original post by JiiaI'm trying to convert a percentage of volume into a DirectSound decibel level. Strange how there are absolutely no threads to find about this. It's either very easy or no one even realizes the difference. Or perhaps everyone that uses DirectSound uses no other sound API, and works purely in decibels.

Decibels are measured from some reference point. I mean that, often 0dB means the volume which is the lowest volume you just and just can hear (or actually you can't). This volume level is personal.

In some pre-amplifiers the 0dB level is the maximum volume and something like -90dB will be the minimun volume level. That is, they use the level of damping.

Now if you really really wan't to represent 0% volume (meaning no sound at all) you would need to use -infinity dB, regardless of what is your reference. But in practive 16bit quantization of audio gives you aprox 90dB of dynamics so -90dB "volume level" probably equals to 0% (assuming 0db <-> 100%).

But you really have to know the reference DirectSound is using. And what scale it is using. Do you really need the 0%, which would require representation of -infinity? If not then some form of adjustment to the normal decibel equations is needed so that -90dB would equal to 0% and 0db to 100% (depending what's your reference).

##### Share on other sites
Damn, Mike. That's crazy! I really appreciate you going through hell to accomplish it. I also wish I had a clue how to follow it. I did test it, and it seems like it's outputing the correct db ranges, but I'm not sure how to be certain. So you're computing the db level without even knowing the range of Dbs represented in DirectSound? Hmm, I've heard some people say that's impossible. It's going to take me days to comprehend your 30 minute work. Guess I should get started.

Yes, DirectSound uses damping. Db is specified in hundredths of a decibel ranging from -10000 to 0, where -10000 is silence. But -3000 is about where the sound can no longer be heard. So MS uses -100db to 0db. But reversing the order should be simple, right? I mean surely decibels count up the same way they count down?

I need to look into this log10 thing, it's new to me. I've seen it a bunch on decibel sites, but didn't realize it was a standard math function. My bad :(

##### Share on other sites
Most volume sliders work on a logarithmic scale anyway, since that's how humans perceive loudness. So 50% volume is not 50% as much power transfer as 100% volume on a normal volume control. It's much less.

##### Share on other sites
just as a short reference for log:

it basically tells your what power of the logrithum a given number is for example log10 of 100 = 2 because 2 ^ 10 = 100
also log2 of 16 = 4 because 2 ^ 4 = 16

hope i helped =)

##### Share on other sites
20 dB is 10x more VOLTAGE (which means 40x more POWER).

Thus, 40 dB is 100x voltage, 60 dB is 1000x voltage, 80 dB is 10000x voltage.

65536x voltage is about 98 dB, and a single bit (2x) is about 6 dB, give or take.

##### Share on other sites
Quote:
 Original post by furby100Most volume sliders work on a logarithmic scale anyway, since that's how humans perceive loudness. So 50% volume is not 50% as much power transfer as 100% volume on a normal volume control. It's much less.

I don't see your point, though. I plan to impliment several sound APIs the user can choose from, and DirectSound is the only API that uses decibels to control volume. So my game engine will handle volume in the most generic way, and convert to each API's format.

No offense to sound professionals, but the last format I would work with would be decibel levels.

Thanks for all of the help, I doubt I would have figured this out without it.

##### Share on other sites
Quote:
 No offense to sound professionals, but the last format I would work with would be decibel levels.

I would say that they used db because this scale let you simulate more easily phisical situations, like occlusion ans so on, because there are already a lot of formulas involving db's out there.

##### Share on other sites
I redid my math because Im programming an audio lib for my engine and I had the same problem.

The new equation is:

d = 10slog10(p)

Where p is the percentage, d is decibels (scaled), and s is a constant (the scale).

s is API dependant. For DirectSound it is 100. The equation assumes that the range of decibels (scaled) is (-100s,0) and the range of p is (0,1). There is a singularity at p = 0 so you should check for that case.

edit: After looking at some sites the 10 before the s may need to be a 20

##### Share on other sites
first of all, Decibel is a unit for ratios!
so you always should be aware what your reference point is in your special applpication. In electronics Decibel is used to compare electrical powers, and since one Bel means a factor of ten a Decibel is a tenth of this (but on a logarithmic scale). Therefore Decibel is defined as:
x in dB = 10*log10[x] dB
The reason that you sometimes find the definition with a factor of 20 instead of 10 is, that in electrical circuits the power rises with the square of the voltage. This squaring gives you a factor of 2 in front of the log10 therefore the 20. So if you want to describe a power-relationship but compare voltages you use 20 as factor. If you want to compare powers you take the 10.
I hope that clears it up a bit.

Thies

## Create an account or sign in to comment

You need to be a member in order to leave a comment

## Create an account

Sign up for a new account in our community. It's easy!

Register a new account

• ### Forum Statistics

• Total Topics
628282
• Total Posts
2981818

• 9
• 10
• 11
• 17
• 15