On Wed, Jun 09, 2004 at 02:35:56PM +0100, Chris Cannam wrote: > On Wednesday 09 Jun 2004 1:50 pm, Steve Harris wrote: > > A little bit of meter standardisation wouldn't hurt - eg. the point > > at which people show red seems to vary a lot, which has been > > confusing for users. > > Also is there a common convention for how dB levels map to positions > on a fader or meter?
Yes, IEC-268: float iec_scale(float db) { float def = 0.0f; /* Meter deflection %age */ if (db < -70.0f) { def = 0.0f; } else if (db < -60.0f) { def = (db + 70.0f) * 0.25f; } else if (db < -50.0f) { def = (db + 60.0f) * 0.5f + 5.0f; } else if (db < -40.0f) { def = (db + 50.0f) * 0.75f + 7.5; } else if (db < -30.0f) { def = (db + 40.0f) * 1.5f + 15.0f; } else if (db < -20.0f) { def = (db + 30.0f) * 2.0f + 30.0f; } else { def = (db + 20.0f) * 2.5f + 50.0f; } return def; } It also defines which points you should mark on your scale. - Steve