17.01.2013 Views

musicdsp.org source code archive - WSInf

musicdsp.org source code archive - WSInf

musicdsp.org source code archive - WSInf

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Millimeter to DB (faders...) (click this to go back to the index)<br />

References : Posted by James McCartney<br />

Notes :<br />

These two functions reproduce a traditional professional<br />

mixer fader taper.<br />

MMtoDB converts millimeters of fader travel from the<br />

bottom of the fader for a 100 millimeter fader into<br />

decibels. DBtoMM is the inverse.<br />

The taper is as follows from the top:<br />

The top of the fader is +10 dB<br />

100 mm to 52 mm : -5 dB per 12 mm<br />

52 mm to 16 mm : -10 dB per 12 mm<br />

16 mm to 4 mm : -20 dB per 12 mm<br />

4 mm to 0 mm : fade to zero. (in these functions I go to -200dB<br />

which is effectively zero for up to 32 bit audio.)<br />

Code :<br />

float MMtoDB(float mm)<br />

{<br />

float db;<br />

}<br />

mm = 100. - mm;<br />

if (mm = 10.) {<br />

mm = 0.;<br />

} else if (db > -10.) {<br />

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

} else if (db > -40.) {<br />

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

} else if (db > -60.) {<br />

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

} else if (db > -200.) {<br />

mm = 96. - 1./35. * (db + 60.);<br />

} else mm = 100.;<br />

}<br />

mm = 100. - mm;<br />

return mm;<br />

Comments<br />

from : Christian@savioursofsoul.de<br />

comment : Pascal Translation...<br />

function MMtoDB(Milimeter:Single):Single;<br />

var mm: Single;<br />

begin<br />

mm:=100-Milimeter;<br />

if mm = 0 then Result:=10<br />

else if mm < 48 then Result:=10-5/12*mm;<br />

else if mm < 84 then Result:=-10-10/12*(mm-48);<br />

else if mm < 96 then Result:=-40-20./12*(mm-84);<br />

else if mm < 100 then Result:=-60-35*(mm-96);<br />

else Result:=-200.;<br />

end;<br />

function DBtoMM(db:Single):Single;<br />

begin<br />

if db>=10 then result:=0;<br />

else if db>-10 then result:=-12/5*(db-10);<br />

else if db>-40 then result:=48-12/10(db+10);<br />

else if db>-60 then result:=84-12/20(db+40);<br />

else if db>-200 then result:=96-1/35(db+60);<br />

else result:=100.;<br />

Result:=100-Result;<br />

end;

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!