Decibel (dB) to Float Value Calculator - Making Sense of Linear Values in Audio Tools!

Decibel (dB) to Float Value Calculator – Making Sense of Linear Values in Audio Tools!

TYPE IN YOUR VALUES TO THE BOXES BELOW

______________________________

(Type -100 dBFS to 0 dBFS)

Linear Value Equivalent

______________________________

(Type 0.0 to 1.0)

dB Value Equivalent

______________________________
PICTURE THIS: You are up all night working in an audio tool for a deadline. The coffee is running low, and you are trying to adjust some levels in a video game editor like Unity. You decide that some sounds are too loud and want to turn them down about 8dB. In any DAW this would be a ridiculously simple task. 

So, you go over to adjust the volume in your tool, but… WAIT! The values aren’t in decibels!?!? All you can see are volume values of 0.0 to 1.0! You become lost and confused. You start to question everything you thought you knew about sound. FEAR NOT! You can easily avoid your existential crisis by using the dB to Float Value Calculator I made here. Allow me to explain what this is all about ūüôā

When you see values from 0.0 to 1.0 there is a VERY good chance that the tool is using LINEAR values. This is extremely counter-intuitive to audio professionals because we ALWAYS think and work in Decibels (dB). Decibels are based on a logarithmic scale while the linear values are a straight line. 

HOW TO USE THE dB TO FLOAT CALCULATOR

In order to use tools that use a linear scale for volume adjustment, you’ll need to convert the LINEAR values into DECIBEL values! Unfortunately, Decibels and Linear values can be very confusing! Most people I know didn’t exactly enjoy dealing with exponents and logarithms back in school… Well, I spent some time programming up this dB to floating point value calculator in¬†HTML5 and now you will NEVER¬†have to manually convert these values again! HOORAY FOR TECHNOLOGY!

I made this calculator to translate DECIBELS into LINEAR FLOAT POINT VALUES as well as convert LINEAR FLOATING POINT VALUES into DECIBELS! FLOAT VALUES are from 0.0 to 1.0 where 0.0 is silent and 1.0 is full volume (0dBFS). DECIBEL VALUES are from -inf to 0dBFS where -inf is silent and 0dBFS is as loud as possible before digital clipping occurs. 

HOW TO USE THE dB TO FLOAT VALUE CALCULATOR (EXAMPLE):

Let’s say you want to turn a float value down 6dB. Let’s also say it’s currently set at .8 in the Linear to dB¬†tool.

First, type in .8 to the calculator to get a dBFS level. In this case it’s -1.93, but we’ll say -2dB.

Now, since you want that value 6dB lower you know you want it at -8dB. Type -8dB into the dB value to Float value Converter tool. This will give you the Linear value that is 6dB quieter than the current value. In this case it is .398.

You can also just type in random float values into the Linear to dB tool until the values are about where you want them to be! I hope you find this as useful as I do.

This tool was inspired by Matthew Thies who created a tool just like this. It made me realize that it would be useful to other people, so I learned HTML5 and put it online for all the game audio people who finally have had enough of manually adjusting Linear values!

WHY FLOAT VALUES ARE TERRIBLE IN AUDIO TOOLS:

There are plenty of reasons why NO AUDIO TOOLS SHOULD EVER have linear values.

First of all, audio professionals spend every moment of their career thinking in terms of decibels, which are logarithmic curves instead of linear curves. Since it’s a part of our language, there is no reason for tools to be in abstract values we have to convert to use.

Second, it becomes completely absurd to handle values below -6dB. It’s not so to guess at values from 1.0 to .6 in linear values because they are ALMOST a 1dB drop a piece. Once you attempt to adjust a sound below -20dB in linear values you can understand what I’m saying.

Changing -22dBFS to -32dBFS is only a .05 difference in linear values. That SAME 10dB change from -10dBFS to 0dBFS is .7. Yes, to an audio engineer the change from -22 to -32 is the same dBFS change as from -10 to 0dBFS, but the difference in linear values is a whopping .65! This makes linear values unmanageable and maddening to any professionals in the audio world.

Here is a chart to show you how ridiculous this is. The linear values are on the left and equivalent decibel curve values are on the right. 

Equations in log base 10:

linear-to-db(x) = log(x) * 20
db-to-linear(x) = 10^(x / 20)

decibel_values_vs_linear_values_comparison_excel_sheet

WHAT TOOLS USE LINEAR VALUES AND WHY:

There are a shockingly large amount of game audio tools using linear float values in my experience. Typically, this occurs because programmers don’t think like audio professionals. They think in terms of numbers and values so to them it really makes just as much sense to have simple values from 0.0 to 1.0 to manage. Also, sometimes there are¬†people that program audio engines or tools don’t have much experience with audio so they don’t consider the value of thinking in decibels.

I’ve use many proprietary toolsets that use linear values. Even some widely popular tools like Unity have linear values for their audio volumes. It doesn’t have to be this way!

It doesn’t have to be this way! If you are making game audio tools, or have influence over new audio tools in a game engine, convince your programmers to ONLY use dB values for volumes! I hope it is obvious to see why this is important after reading this article!¬†

I hope this makes your lives easier ūüôā Game audio is difficult enough!

– Aaron Brown

Thanks for visiting PlayDotSound! Your best resource for learning about video game sound!
Come back soon for more posts about game audio, sound design, composition, integration using engines like Unreal and Unity, and much more.
 
Play Dot Sound is created by multiple award winning sound designers and composers in the video game audio industry. Our purpose is to educate, connect and inspire both beginners and professionals to make better sounds for their games.
 
Aaron Brown –¬†http://www.AaronBrownSound.com
Brad Fotsch –¬†http://www.bradfotsch.com/
Matt Piersall –¬†http://www.Gl33k.com
Calculator icon made by Freepik from www.flaticon.com

 

  • http://www.bazz1.com/ thisisbazz

    great article I loved it..
    I am lacking an explanation behind the calculation of
    20 * log10(linear) = dbfs

    Could you explain to me what that comes from.. I last understood that db is about the ratio between 2 things??

    I see, I’m molding 2 ideas together that need to be seperate.. I’m starting to understand how in a 16-bit full-scale audio system, the peak is the “reference” 32,767 or -32,768 and is a part of the ratio.
    20 * log10(linear / peak) = dbfs

    I’m at a point where I can use the former for the gain coefficient and the latter for the “VU meter” on the waveform samples, but I still don’t exactly understand the meaning behind the calculations… ie. why 20 * , why the lack of ratio in the former, why the ratio in the latter??