View Single Post
Old 06-11-2019, 09:13 AM   #1
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 19,677
Default JSFX: convert amplitude to dB?

I thought that I would use
Code:
dB_level = floor(20 * log10((abs(spl0) + abs(spl1))/2));
to convert the average audio amplitude to dB.

I looked in some other JSFX and saw:
Code:
sc=6/log(2); // 8.656 
dB_level2 = floor(log((abs(spl0) + abs(spl1))/2)*sc); // dB
What am I getting wrong? If they give the same result, which is more efficient? And why?
__________________
DarkStar ... interesting, if true. . . . Inspired by ...

Last edited by DarkStar; 06-11-2019 at 11:31 AM.
DarkStar is offline   Reply With Quote