import("stdfaust.lib"); vCompGain = hbargraph("[5]Compressor Gain[unit:dB]",-50,10); vGain = hbargraph("[6]Input Gain[unit:dB]",-50,10); compressor(ratio,thresh,att,rel,kneeAtt) = _ <: *(an.amp_follower_ud(att,rel) : ba.linear2db : vGain : outminusdb(ratio,thresh) : kneesmooth(kneeAtt) : vCompGain : ba.db2linear) with{ outminusdb(ratio,thresh,level) = max(level-thresh,0)*(1/ratio-1); kneesmooth(att) = si.smooth(ba.tau2pole(att)); }; ratio = hslider("[0]Ratio",1,1,20,0.001) : si.smoo; thresh = hslider("[1]Threshold[unit:dB]",-30,-60,0,0.01) : si.smoo; att = hslider("[2]Attack[unit:ms]",50,0,500,0.1)*0.001; rel = hslider("[3]Release[unit:ms]",100,0,1000,0.1)*0.001; kneeAtt = hslider("[4]Knee Attack[unit:ms]",25,0,500,0.1)*0.001; process = vgroup("Compressor",compressor(ratio,thresh,att,rel,kneeAtt));