Today I would like to take a little time and talk about a subject that is very important to understand when working in the digital audio domain, and that is how to convert between floating-point and decibel.  Know how to convert between these two will be very useful when you are working with dynamics such as compressors and limiters, or even just simple volume controls.  It is good to have a way to perceive the data that is familiar to us.

What Is a Decibel?

Decibel or dB is a measure of volume that is in the range of -96 to 0.  It has a logarithmic relationship to the floating-point range that we normally work with.  Decibel is used since our ears hear sounds in a logarithmic nature.

Decibel – To – Float

The equation for converting from dB to floating-point is as follows.

float = 10 ^ (dB/20)

decibel-to-float

where dB is a number in the range of -96 to 0.  This equation is extremely useful for when you have volume controls that are in dB. You can just convert to the floating point number which can be used as a scalar multiplier in your audio processing.

Float – To – Decibel

The equation for floating-point to dB conversion is just an inverse of the previous equation.

dB = 20 * log(float)

float-to-decibel

Domain and Range

It is very important to consider the domain and range of these equations.  Decibel-to-Float has a domain of {-96, 0}, and a range of {0.0000158, 1}.  The domain of the function can be lower than -96 but we want to cut it off here since that is the range commonly used.  Also when converting from Float-To-Decibel, we want to start the domain at 0.0000158 since that will give us the output of -96.  If we try to plug in 0 in this equation we will get an error.

Conclusion

I strongly recommend for you to get familiar with these equations since they are extremely useful when working in digital audio.

Sign up for our newsletter so you dont miss new deals and anouncements!

Please follow and like us:
Categories: AudioProgramming

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Posts

Audio

Entropy II Released – VST and AU Plug-in

If you have been using Entropy and enjoy it’s features then I have good news for you.  Entropy II is out!  This version adds many new features such as tempo syncing, feedback filtering, and saturation.  Read more…

Audio

M4 Is Released – VST & AU Plug-in

M4 is finally finished and can now be purchased by heading over to our products page here! http://www.modernmetalproduction.com/products/ If you didn’t see our previous post, let me fill you in. M4 is a Multiband Compressor Read more…

D

Dplug For Developing VST Plugins on Linux

Developing VST Plugins for Linux is something that has always been of great interest to me personally.  There never seemed to be a framework that was easily portable to Linux aside from JUCE.  Why not Read more…