9 Mar
2006
9 Mar
'06
1:40 a.m.
On 8-Mar-06, at 9:25 PM, Ge Wang wrote:
fun float dbtogain( float db ) { return math.pow( 2, db/3 ); }
fun float gaintodb( float gain ) { return 3 * math.log(gain) / math.log(2); }
Thanks, that's great! Please add these to std, since there's already std.dbtorms and std.dbtopow in there. I'm not certain how those functions are supposed to work, though. The below code gives me "0.000 0.000 / 0.000 0.000". This is with chuck 1.2.0.4. float f1, f2; 0 => f1; -6 => f2; std.dbtorms(f1) => f1; std.dbtorms(f2) => f2; <<< f1, f2>>>; 0 => f1; -6 => f2; std.dbtopow(f1) => f1; std.dbtopow(f2) => f2; <<< f1, f2>>>;