| 1 |
class Module(BaseModule): |
| 2 |
""" |
| 3 |
"Dynamic compression and gate module" |
| 4 |
|
| 5 |
Description |
| 6 |
|
| 7 |
This module can be used to adjust the dynamic range of a signal by applying a compressor |
| 8 |
followed by a gate. |
| 9 |
|
| 10 |
Sliders |
| 11 |
|
| 12 |
# Input Gain : |
| 13 |
Adjust the amount of signal sent to the processing chain |
| 14 |
# Comp Thresh : |
| 15 |
dB value at which the compressor becomes active |
| 16 |
# Comp Rise Time : |
| 17 |
Time taken by the compressor to reach compression ratio |
| 18 |
# Comp Fall Time : |
| 19 |
Time taken by the compressor to reach uncompressed state |
| 20 |
# Comp Knee : |
| 21 |
Steepness of the compression curve |
| 22 |
# Gate Thresh : |
| 23 |
dB value at which the gate becomes active |
| 24 |
# Gate Rise Time : |
| 25 |
Time taken to open the gate |
| 26 |
# Gate Fall Time : |
| 27 |
Time taken to close the gate |
| 28 |
# Output Gain : |
| 29 |
Makeup gain applied after the processing chain |
| 30 |
|
| 31 |
Graph Only |
| 32 |
|
| 33 |
# Overall Amplitude : |
| 34 |
The amplitude curve applied on the total duration of the performance |
| 35 |
|
| 36 |
Popups & Toggles |
| 37 |
|
| 38 |
# Compression Ratio : |
| 39 |
Ratio between the compressed signal and the uncompressed signal |
| 40 |
# Polyphony Voices : |
| 41 |
Number of voices played simultaneously (polyphony), |
| 42 |
only available at initialization time |
| 43 |
# Polyphony Spread : |
| 44 |
Pitch variation between voices (chorus), |
| 45 |
only available at initialization time |
| 46 |
|
| 47 |
""" |
| 48 |
def __init__(self): |
| 49 |
BaseModule.__init__(self) |
| 50 |
self.snd = self.addSampler("snd") |
| 51 |
self.crank = Sig(self.snd, mul=DBToA(self.inputgain)) |
| 52 |
self.comp = Compress(input=self.crank, thresh=self.compthresh, ratio=1, risetime=self.comprise, |
| 53 |
falltime=self.compfall, lookahead=5, knee=self.compknee.get(), outputAmp=False, mul=1) |
| 54 |
self.gate = Gate(input=self.comp , thresh=self.gatethresh, risetime=self.gaterise, |
| 55 |
falltime=self.gatefall, lookahead=5.00, outputAmp=False, mul=DBToA(self.outputgain)) |
| 56 |
self.out = self.gate*self.env |
| 57 |
|
| 58 |
#INIT |
| 59 |
self.compratio(self.compratio_index, self.compratio_value) |
| 60 |
|
| 61 |
def compratio(self, index, value): |
| 62 |
ratioList = [0.25,0.5,1,2,3,5,8,13,21,34,55,100] |
| 63 |
self.comp.ratio = ratioList[index] |
| 64 |
|
| 65 |
def compknee_up(self, value): |
| 66 |
self.comp.knee = value |
| 67 |
|
| 68 |
Interface = [ csampler(name="snd"), |
| 69 |
cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"), |
| 70 |
cslider(name="inputgain", label="Input Gain", min=-48, max=18, init=0, rel="lin", unit="dB", col="blue1"), |
| 71 |
cslider(name="compthresh", label="Comp Thresh", min=-60, max=-0.1, init=-20, rel="lin", unit="dB", col="orange1"), |
| 72 |
cslider(name="comprise", label="Comp Rise Time", min=0.01, max=1, init=0.01, rel="lin", unit="sec", col="orange2"), |
| 73 |
cslider(name="compfall", label="Comp Fall Time", min=0.01, max=1, init=0.1, rel="lin", unit="sec", col="orange3"), |
| 74 |
cslider(name="gatethresh", label="Gate Thresh", min=-80, max=-0.1, init=-60, rel="lin", unit="dB", col="green1"), |
| 75 |
cslider(name="gaterise", label="Gate Rise Time", min=0.01, max=1, init=0.01, rel="lin", unit="x", col="green2"), |
| 76 |
cslider(name="gatefall", label="Gate Fall Time", min=0.01, max=1, init=0.1, rel="lin", unit="x", col="green3"), |
| 77 |
cslider(name="compknee", label="Comp Knee", min=0, max=1, init=0.5, rel="lin", unit="x", up=True, col="orange4"), |
| 78 |
cslider(name="outputgain", label="Output Gain", min=-48, max=18, init=0, rel="lin", unit="dB", col="blue1"), |
| 79 |
cpopup(name="compratio", label="Comp Ratio", init="1:1", col="orange1", value=["0.25:1", "0.5:1", "1:1", "2:1", "3:1", "5:1", "8:1", "13:1", "21:1", |
| 80 |
"34:1", "55:1", "100:1"]), |
| 81 |
cpoly() |
| 82 |
] |
| 83 |
|