[LAD] Gain in dB

John Rigg ladev6 at jrigg.co.uk
Wed Oct 16 08:51:21 UTC 2013


On Tue, Oct 15, 2013 at 04:41:46PM -0400, Fred Gleason wrote:
> On Oct 15, 2013, at 10:11 05, André Garnier Coutinho wrote:
> 
> > GdB = 20log(Out/In) ?
> 
> Close.  You actually want:
> 
> 	GdB = 20*log10(out/in)
> 
> You probably knew this already as standard mathematical notation assumes log == 'log to the base of 10'.  However, the log() function in the math library will get you natural logarithms ('log to the base of e').  You want log10().  Been there, done that confusion myself…  :)

Good catch. I was thinking of the non-C convention of using log for base 10 and ln for natural log when I answered.

John


More information about the Linux-audio-dev mailing list