• ### dbtorms

Hi all!
I am into a project that I think I have to understand what is inside [dbtorms]. Extended shows that the formulae is:

RMS = (exp((2.302585092994 * 0.05) * (db_value - 100))

but i cannnot figure out how this formulae is derived..

any ideas?

thanks!

• Posts 5 | Views 5389
• Hi,

`RMS = exp10(dB/20)` with
`exp10(x) = exp(x*ln(10))`,
`ln(10) ≈ 2.302585092994` and
`1/20 = 0.05` so
`RMS = exp(2.302585092994*0.05*dB)`

Now, Pd assumes that 100 dB corresponds to an "RMS" of 1 amplitude but the formula assumes that the 0 dB corresponds to an "RMS" of 1 amplitude so
`RMS = exp(2.302585092994*0.05*(dB-100))`

see https://en.wikipedia.org/wiki/Decibel#Acoustics (and Pref = 1)

• Thank you Pierre for your response!
I got confused seeing exp instead of log..but now I got it! Thanks!

Another question that I have, is why pure data assumes the useful range is 100db..I mean, if I have let's say an audio interface with a dynamic range of 94 db, should this number matter the RMS formula?

• @pomolo said:

I mean, if I have let's say an audio interface with a dynamic range of 94 db, should this number matter the RMS formula?

Yes, of course. There are 2 important things to consider: the equivalent in dB to 1 RMS amplitude and the equivalent in dB to 0 RMS amplitude because if you multiply a signal by the RMS amplitude, 1 RMS ensures that the signal is unchanged and 0 RMS ensures hat the signal is muted. With the original formula, 0 dB corresponds to 1 RMS amplitude and -infinity corresponds to 0 RMS amplitude. As you can't reach -infinity, usually -100 dB which should correspond to 0.0001 RMS is rounded down to 0 RMS. So it gives you a usable range in dB between -100 and 0. I guess that Miller thought that it is more "usable" in the Pd context, to add 100 and set the range between 0 and 100. And to the question: why not clipping at -90 dB or -94dB instead of -100 dB? For the same reason, I guess because -100 dB is relatively equivalent to -90 dB in term of perception but a range of 100 dB is much more usable. I hope you didn't get lost in this explanation...

• @pomolo This needed re-writing.
Dynamic range is meaningless in Pd (or any computer digital processing), in that it cannot be reproduced in the real world. The dynamic range is determined by the ratio of the biggest possible number to the smallest. Even in Pd 32-bit the biggest possible number is massive compared to the smallest.
Of course for FFT the dynamic range is constrained, as it depends on the sample-rate and bit depth.......
https://en.wikipedia.org/wiki/Audio_bit_depth

dB(something) becomes fixed, with real measurable (but weighted) values, when it is measured as sound waves in the air....... and it is fixed then because it is universally agreed that 0dB is the smallest pressure wave that can be heard by a human.
Only then can you define +100dB

RMS..... volts do not "exist" either until the [dac~] does it's work
How you scale the numbers to match your soundcard is up to you.
As Pierre says above 1V = +100dB has been "chosen" as sensible for Pd.
But as we all know, a traditional VU meter will show 0dB as "maximum".... not +100dB.
Hence the dB-100 part of the formula above.

+1...-1 (about zero) is considered safe for [dac~]
If the soundcard sees 1 as max for its conversion to analog all is well.

At 1.00001 it will clip. This value is fixed and known. There is nothing to be done about it.
The dynamic range of your card is not from 0dB to +94dB.
(Well....... it is, but that is what confuses the mind).
Its dynamic range is determined by its noise floor, and your card has a noise floor 94dB "below" the maximum that it can output before clipping.
The dynamic range of your card is from -94dB to 0dB........ if we agree that it will "clip" above 0dB.

So if Pd +100dB is 1 (in fact shown on the VU Gui in Pd as 0dB) then when the Pd Gui shows -95dB any Pd output will be masked by the noise floor of the soundcard....... (or more likely by dither if the soundcard is any good), as the very small numbers cannot be properly resolved, and that results in unpleasant audible artefacts.

And then there is the metering of the soundcard (if it has any).
Because it was traditional to overload magnetic tape, many of the first pro digital systems actually showed 0dB (the max number without clipping) as +18dB..... and showed red bars from +12dB upwards. Trying to make sure you would not clip your recording.
This has most of the info you are looking for I think........
https://sound.stackexchange.com/questions/25529/what-is-0-db-in-digital-audio

As with any analog or digital system you need to know "where you are" with the audio chain before you start work. Set an oscillator into a [dac~] with a VU driven by [pvu~]. You will see 0dB on the meter (1V RMS in Pd).
Do you need to trim the output of all your patches with a [*~ ?].?
Probably not.
Are there standards
No, not for metering.
If it shows +18dB or +12dB that is probably correct.
0dB on the Pd VU should show as the last bar on your soundcard before the red bars, but the soundcard metering might be lying..... to save you from yourself.
You will only get clipping where the maximum possible value is exceeded.

Volts, RMS or peak, are measures on a linear scale.
But our ears hear "power" and so the dB scale of relative power is a logarithmic scale.

The formula above equates the linear scale to the log scale, but they can "slide" against each other.
Putting an amplifier increases the volts, but how much more volume (dB) you get depends on the efficiency of the speaker...... losses in cables etc.

Only when you have decided 0dB can you say what is 100dB.
Or when you have decided 100dB you can say "how much" is 0dB.
Because it is all relative.
David.

Posts 5 | Views 5389
Internal error.

Oops! Looks like something went wrong!