question: static float linearToDB ( float linear ) { float dB = ( float ) ( Math . log ( ( double ) ( ( linear == 0.0 ) ? 0.0001 : linear ) ) / Math . log ( 10.0 ) * 20.0 ) ; return dB ; }
target:  Linear to DB scale conversion.