Audio decibel convert to linear scale
I’m just about finished doing the research for a fourier synthesis post to show how to use the inverse fourier transform to turn frequency information into audio samples.
Here are some dB values and corresponding amplitude values to help you better understand how dB and amplitude are related. Inline float AmplitudeTodB(float amplitude) Here’s some c++ code which does those two operations: Note that when converting audio samples to dB, you want to take the absolute value of the audio sample, since sign doesn’t matter for loudness. To convert from dB to amplitude, the formula is: amplitude = 10^(db/20) To convert from amplitude to dB, the formula is: dB = 20 * log10(amplitude) This has a nice side benefit that you can make the cutoff point of “assumed silence” be above the level that floating point denormals are (very small numbers that need special processing and are slower to work with than regular floating point numbers), so that in effect you can use this to remove denormals from your processing, which can boost the performance of your code. People will usually adopt a convention of saying that below -60dB is silence, or below -96dB is silence. dB (Decibel) is the most important and often used scale in the RF field, but it’s also understandably difficult and confusing for someone just being introduced to it. Visit ABOUT to see what you can learn from this blog.’. Doing the same with amplitude, 0.5 means that the volume is cut in half, and then you multiply that by 0.5 to get 0.25 to make it 1/4 as loud, and multiply again to get 0.125 which is 1/8 as loud.Ī fun byproduct of this is that using dB you can never describe zero (silence) exactly. ‘Note: This is an article written by an RF engineer who has worked in this field for over 40 years. That is, sound power in decibels is 120 dB. Since the pico prefix implies 10-12, and since we take the base-10 log of the reciprocal of this number (because we divide 1 Watt by this number), the base-10 log value is 12, which we multiply by 10 to get 120 dBpW. 6db means that the volume has been cut in half, and -12db means that it has been cut in half again (so is 1/4 as loud) and -18db means that it has been cut in half yet again (now 1/8 as loud). For sound power in decibels, we need to convert 1 Watt to picoWatt. 0dB means full volume and positive numbers means a boost in volume, while negative numbers mean a decrease in volume.ĭB combines linearly, unlike amplitudes which have to multiply together. The main issue is that our ears do not hear linear adjustments in amplitude as linear adjustments in loudness, but linear adjustments in dB do sound like they are linear adjustments in loudness.ĭB is a bit easier to understand as well. If you work with musicians or other audio folk, chances are they are not going to think in amplitude, may not be able to easily adjust to thinking in amplitude, and instead will talk to you in terms of decibels or dB, which is as foreign to you as amplitude is to them. That 0.5 is a scalar value in amplitude space. The letters A and C indicate which frequency weighting filter should be applied to the measured sound.If you are a programmer, chances are that when you think of volume or volume adjustments of audio signals (or other streams of data), you are thinking in terms of amplitude.įor instance, to make an audio stream quieter, you are probably going to multiply all the samples by 0.5 to bring it down in volume. For example, maximum noise levels at work, as recommended by the World Health Organization (WHO), are L Aeq = 85 dB and L Cpeak = 135 dB. dB is used to represent the ratio of two power or voltage levels. The Z-Weighting (no weighting and thus no filter) may be applied, for example, where an analysis of the sound source is required rather than the effect the sound has on humans, such as in testing the frequency response of produced loudspeakers in a manufacturing process.įrequency weightings are used when describing sound levels. Background The deciBel or dB scale is a convenient way to represent both large and small numbers. Background The deciBel or dB scale is a convenient way to represent both large and small numbers. The C-weighting filter is often applied when representing peak levels.
The A and C weightings are thus most meaningful for describing the frequency response of the human ear toward real world sounds.Īs acoustic sound level measurements are often motivated by the effect of sounds on humans, the A-weighting filter is commonly applied. The C-Weighting curve represents what humans hear when the sound is turned up we become more sensitive to the lower frequencies. Acoustic sound contains more lower and higher frequencies than humans perceive. What humans are physically capable of hearing is represented by the A-Weighting curve. If a sound is produced with equal sound pressure across the whole frequency spectrum, it could be represented in the graph below by the Z-Weighting line. Certified sound level meters offer noise measurements with A, C and Z frequency weighting.