back to Index



GUI LEVEL-FADER TAPER FORMULAS:


These two functions reproduce a traditional professional mixer fader taper and have been used for all level faders in AudioSwitcher Server and AudioSwitcher Control.

3rd party developers may prefer to use these in order to reproduce similar fader/dB look and feel in their software/hardware. 

References: Modified from online post by James McCartney (http://www.musicdsp.org/showone.php?id=94)



/*

MMtoDB converts millimeters of fader travel from the

bottom of the fader for a 100 millimeter fader into

decibels. DBtoMM is the inverse.


The taper is as follows from the top:

The top of the fader is +10 dB

100 mm to 52 mm : -5 dB per 12 mm

52 mm to 16 mm : -10 dB per 12 mm

16 mm to 4 mm : -20 dB per 12 mm

4 mm to 0 mm : fade to zero.


In these functions I go to -120dB, which is interpreted 

as zero by AudioSwitcher.

*/


float MMtoDB(float mm)

{

    float db;

    mm = 100. - mm;


    if (mm <= 0.)

        db = 10.;

    else if (mm < 48.)

        db = 10. - 5./12. * mm;

    else if (mm < 84.)

        db = -10. - 10./12. * (mm - 48.);

    else if (mm < 96.)

        db = -40. - 20./12. * (mm - 84.);

    else if (mm < 100.)

        db = -60. - 10. * (mm - 96.);

    else 

        db = -120.;


return db;

}


float DBtoMM(float db)

{

    float mm;


    if (db >= 10.)

        mm = 0.;

    else if (db > -10.)

        mm = -12./5. * (db - 10.);

    else if (db > -40.)

        mm = 48. - 12./10. * (db + 10.);

    else if (db > -60.)

        mm = 84. - 12./20. * (db + 40.);

    else if (db > -120.)

        mm = 96. - 1./10. * (db + 60.);

    else 

        mm = 100.;


    mm = 100. - mm;

    return mm;

}