In The Old Days...
Prior to the invention of electronic calculators, multiplying and dividing long numbers was painful. Yet that was something engineers (including audio ones) had to do often.
Logarithms were invented in the 17th century to simplify calculations.
We have these fundamental rules of logarithms:
log(X * Y) = log(X) + log(Y)
log(X / Y) = log(X) - log(Y)
While rather innocent looking, they conceal great power: The ability to replace complex multiplication and division calculations with simple addition and subtraction ones.
There is a catch though - you needed to know the log value of numbers. But as the benefit outweighed the pain, soon books with log charts appeared showing the log value of numbers (my dad had one!).
So to multiply two long numbers, you find in the chart the log of both first, add them, and then search for the inverse log of your addition result.
Logarithmic rulers soon appeared, allowing quicker calculations:
Then Came Audio
With advances in electronics and audio recording technology it soon became clear that our perception of loudness is exponential, rather than linear.
That is, when reproduced via a speaker, the loudness change from 1V to 2V is not perceived as equal as the loudness change from 2V to 3V. The doubling of voltage is much closer to our loudness perception - 1V to 2V is roughly like 2V to 4V.
Log functions are exponential.
Now guess what? The engineers at Bell Laboratories decided to make the log an integral part of audio. They gathered what you may have gathered by now:
- Logs make calculations easier.
- Logs lend themselves better to the exponential nature of our hearing.
So they simply devised a unit called Bell (in honour of Graham Bell), which is nothing but a ratio between two measurements, logged:
Bell = log(m1 / m2)
Soon though, the realisation came that for audio applications the Bells always had an extra significant digit to the right of the decimal point. So they introduced another unit called decibel, which, after working out the maths of the original definition of the bell, resulted in:
dB = 10 * log(m1 / m2)
(This has hunted me for years: deci means a tenth, as in a decimetre = tenth of a metre; whereas here we have Bell times ten. It's not until you dig for the original Bell equation, which I'm sparing you from here, that you see that they did divide a part of it by ten, ending up after simplification with the equation above.)
Power vs Voltage
The decibel definition was devised for power measurements (watts), so we can look at it as a ratio between two power measurements:
dB = 10 * log(p1 / p2)
Once we throw into the equation voltages (where P = V^2 / R) and simplify it, the equation becomes:
dB = 20 * log(v1 / v2)
Which is most often written:
dB = 20log(v1 / v2)
Practically speaking, all dB equations are 20log, barring those dealing with power.
From Two Measurements to a Measurements and a Reference
So far, dBs allow us to express the ratio between two measurements. But what if we measured the level of our signal and ask:
"How loud is this in dBs?"
The answer will be:
"Well, how loud compared to what?"
So the idea was to choose a reference, so we can express the level of something in dBs by measuring it and comparing it to a standard reference. In equation form:
dB = 20log(m / r)
So now we can develop various systems of dBs, each uses a different reference.
- The dBm system uses 1mW as a reference.
- The dBu system uses 0.775V as a reference (a number that was common in early electronic circuits).
- The dBV system uses 1V as a reference (a much easier number to deal with).
When digital audio emerged, it needed its own dB system, which brought the need to choose a reference. But there was a problem:
Digital audio can be 8 bits (sample values from 0 to 255) or 16 bit (0..65535) or 24 bit (0..16777216).
It seems like the common thing in all these bit depths is the zero, but we can't use it as a reference as we'll get:
dBFS = 20log(m / 0)
While this is sufficient to rule out 0 as a reference, there is another fact to consider: We know that during ADC a higher bit depth extends the dynamic range downwards not upwards. In other words, the loudest analog voltage an ADC supports always translates to the highest value the bits can represent. If the analog limit is 1V, in an 8 bit system it will get a sample value of 255, but in a 16 bit system it will get 65535.
This make the choice rather obvious - the reference for dBFS should be the highest sample value of the system bit depth. So:
dBFS = 20log(sample value / highest possible sample value)
Now in logs, if the numerator is smaller that the denominator, you always get a negative result; if the two are equal, you get 0. So in the case of 16 bits:
0dB = 20log(65535 / 65535)
-6dB = 20log(32768 / 65535).
Since the sample value can never exceed the highest sample value, dBFS values are always equal to, or smaller than 0.
dBVU and dBr
All of this is sound, but there's a bit more.
As users, we don't really care about the dB level of the signal within the system, we care for the dB level compared to the standard operating level of the system (above which you may clip).
So audio meters don't show the dBu, dBV or dBFS level of the signal (some do, but as an extra). Instead they show 0dB as the standard operating level of the system. In analog this is known as 0dBVU (dB Volumatric Unit), and for digital as 0dBr (dB reference). For pro analog equipment 0dBVU is calibrated to +4dBu; for semi-pro equipment it is -10dBV. So regardless of the device itself, and the dB system used, dBVU always tells me how much below or above the standard operating level of the system the signal is.
DAWs are using 32 bit float internally, so the integer range of 0..65535 is aligned to the decimal range
1.0; While 65535 is 0dBFS,
1.0 is 0dBr. But floating point systems can go above
1.0, in fact, much higher than
1.0. Yet as at some point you'll have to go back to integers, the 0dB you see is aligned with 0dBFS.