Dynamic Range Compression Function

Andy Long, March, 2023

We’re going to put together linear functions with bump functions, to create the standard DRC function.

bump is a standard logistic function, with parameter w (which indicates the point at which it reaches

bump[w_,v_]:=1-1/(Exp[v/w]+1)
Solve[bump[w,v]==0.5,w]
D[bump[w,v],v]
Plot[bump[1/43,v],{v,0,110}]

The linear function takes us from a given frequency’s threshold to vMax, the maximum volume we want to product (thinking of that as 110 decibels, say).

vMax=110;
l[tf_,v_]:=tf+(vMax-tf)/vMax v
Plot[l[43,v],{v,0,vMax}]

The DRC function is a combination of these elements.

drc[tf_,v_]:=bump[1/4,(v-tf/20)]*bump[1/4,(tf/20-(v-vMax))]*l[tf,v]+110*bump[1/4,(-tf/20+(v-vMax))]
Plot[drc[43,v],{v,0,vMax*1.2}]

Manipulate[
drc[tf_,v_]:=bump[originWidth,(v-tf/originShift)]*bump[extremeWidth,(tf/extremeShift-(v-extremeStart))]*l[tf,v]+110*bump[extremeWidth,(-tf/extremeShift+(v-extremeStart))];
Show[
Plot[drc[threshold,v],{v,0,vMax*1.2}],
Plot[{vMax,threshold},{v,0,vMax*1.2}]
],
{{originWidth,1/4},.001,1},
{{extremeWidth,20},1,100},
{{originShift,20},1,100},
{{extremeShift,20},1,100},
{{extremeStart,vMax},1,vMax},
{{threshold,20},0,100}
]