I think the relationship is: fun float dbtogain( float db ) { return math.pow( 2, db/3 ); } fun float gaintodb( float gain ) { return 3 * math.log(gain) / math.log(2); } This is using 1.0 gain as reference (0 dB down). * You may have to normalize your input data. (offset all dB values by constant amount) * Both functions probably could be optimized. * gaintodb prefers positive values. * feel free to call me an idiot as always. Best, Ge! On Wed, 8 Mar 2006, Perry R Cook wrote:
I think gain is just linear amplitude multiplication, like 0.0 is nothing, and 1.0 is nominal amplitude, and 0.5 is halfway between in amplitude space, thus -3dB from 1.0.
PRc
On Wed, 8 Mar 2006, Graham Percival wrote:
What is chuck's .gain measured in? Neither std.dbtorms() nor std.dbtopow() seem to work...
I have a bunch of data about a sound, (frequency, dB): 86.132812, 9.996495, 172.265625, 6.996109, 258.398438, -0.955794, 344.531250, -11.900859, ...
and I'd like to try some additive synthesis in chuck. The first value (frequency) is obvious, but I'm at a loss as to what to do with the second value (dB). What's the conversion factor between dB and .gain ?
Cheers, - Graham
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users
_______________________________________________ chuck-users mailing list chuck-users@lists.cs.princeton.edu https://lists.cs.princeton.edu/mailman/listinfo/chuck-users