Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
31 lines (25 sloc) 738 Bytes
// Volume Range Trim
//
// Volume adjustment in a selectable +/- Decibel range for
// more controlled automation moves.
//
// author: chokehold
// url: https://github.com/chkhld/jsfx/
// tags: utility gain range volume trim
//
desc: Volume Range Trim
slider1:amount=0<-1,1,0.01> Trim amount
slider2:range=0<0,4,1{6 dB,12 dB, 24 dB, 48 dB}> Range +/-
in_pin:left input
in_pin:right input
out_pin:left output
out_pin:right output
@init
function dBToGain (decibels) (10.0 ^ (decibels / 20.0));
function sliderTodB () (amount * (6 + ((range > 0) * 6) + ((range > 1) * 6) + ((range > 2) * 6)));
@slider
decibels = sliderTodB();
trim = dBToGain(decibels);
@sample
spl0 *= trim;
spl1 *= trim;
You can’t perform that action at this time.