almost right, but not completely. in general you calculate the dB value as:djarago wrote:Normally you calculate dB as dB = 10*log(output/input) for gain of a system as an example. Another way to calculate dB is dB = 10*log(measured_value/minimum_value) where minimum_value is the minimum detectible amount, so in a 16bit audio the minimum would be 1/32768.0f.
dB = 20 * log10(amp / amp_ref)
where amp is the linear amplitude and amp_ref is some reference value which is taken to be the threshold of hearing for sound pressure levels. but in our vst-world this value is taken to be 1.0 (which is the threshold of clipping when we convert to fixed point numbers). the constant 20 vs. the constant 10 comes from the distinction between amplitude and power levels (10 is to be used for power levels).
