| 1 |
class Module(BaseModule): |
| 2 |
""" |
| 3 |
"Multi-band noise gate module" |
| 4 |
|
| 5 |
Description |
| 6 |
|
| 7 |
MultiBandGate implements four separated spectral band |
| 8 |
noise gaters with independent threshold and gain. |
| 9 |
|
| 10 |
Sliders |
| 11 |
|
| 12 |
# Frequency Splitter : |
| 13 |
Split points for multi-band processing |
| 14 |
# Threshold Band 1 : |
| 15 |
dB value at which the gate becomes active on the first band |
| 16 |
# Gain Band 1 : |
| 17 |
Gain of the gated first band |
| 18 |
# Threshold Band 2 : |
| 19 |
dB value at which the gate becomes active on the second band |
| 20 |
# Gain Band 2 : |
| 21 |
Gain of the gated second band |
| 22 |
# Threshold Band 3 : |
| 23 |
dB value at which the gate becomes active on the third band |
| 24 |
# Gain Band 3 : |
| 25 |
Gain of the gated third band |
| 26 |
# Threshold Band 4 : |
| 27 |
dB value at which the gate becomes active on the fourth band |
| 28 |
# Gain Band 4 : |
| 29 |
Gain of the gated fourth band |
| 30 |
# Rise Time : |
| 31 |
Time taken by the gate to close |
| 32 |
# Fall Time : |
| 33 |
Time taken by the gate to open |
| 34 |
# Dry / Wet : |
| 35 |
Mix between the original signal and the shifted signals |
| 36 |
|
| 37 |
Graph Only |
| 38 |
|
| 39 |
# Overall Amplitude : |
| 40 |
The amplitude curve applied on the total duration of the performance |
| 41 |
|
| 42 |
Popups & Toggles |
| 43 |
|
| 44 |
# Polyphony Voices : |
| 45 |
Number of voices played simultaneously (polyphony), |
| 46 |
only available at initialization time |
| 47 |
# Polyphony Spread : |
| 48 |
Pitch variation between voices (chorus), |
| 49 |
only available at initialization time |
| 50 |
|
| 51 |
""" |
| 52 |
def __init__(self): |
| 53 |
BaseModule.__init__(self) |
| 54 |
self.snd = self.addSampler("snd") |
| 55 |
freqs = self.splitter.get(True) |
| 56 |
self.FBfade = SigTo(value=1, time=.01, init=1) |
| 57 |
self.split = FourBand(input=self.snd, freq1=freqs[0], freq2=freqs[1], freq3=freqs[2], mul=self.FBfade) |
| 58 |
self.threshs = self.duplicate([self.thresh1,self.thresh2,self.thresh3,self.thresh4], len(self.snd)) |
| 59 |
self.mul1 = DBToA(self.gain1) |
| 60 |
self.mul2 = DBToA(self.gain2) |
| 61 |
self.mul3 = DBToA(self.gain3) |
| 62 |
self.mul4 = DBToA(self.gain4) |
| 63 |
self.muls = self.duplicate([self.mul1,self.mul2,self.mul3,self.mul4], len(self.snd)) |
| 64 |
self.gate = Gate(input=self.split, thresh=self.threshs, risetime=self.gaterise, falltime=self.gatefall, lookahead=5.00, |
| 65 |
outputAmp=False, mul=self.muls).mix(self.nchnls) |
| 66 |
self.out = Interp(Delay(self.snd, 0.005, maxdelay=0.005), self.gate, self.drywet, mul=self.env) |
| 67 |
|
| 68 |
def splitter_up(self, value): |
| 69 |
self.FBfade.value = 0 |
| 70 |
time.sleep(.02) |
| 71 |
self.split.freq1 = value[0] |
| 72 |
self.split.freq2 = value[1] |
| 73 |
self.split.freq3 = value[2] |
| 74 |
time.sleep(.02) |
| 75 |
self.FBfade.value = 1 |
| 76 |
|
| 77 |
Interface = [ csampler(name="snd"), |
| 78 |
cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue"), |
| 79 |
csplitter(name="splitter", label="Frequency Splitter", min=100, max=18000, init=[150, 500, 2000], |
| 80 |
num_knobs=3, rel="log", gliss=0, up=True, unit="Hz", col="grey"), |
| 81 |
cslider(name="thresh1", label="Threshold Band 1", min=-80, max=-0.1, init=-60, rel="lin", unit="dB", col="purple1", half=True), |
| 82 |
cslider(name="gain1", label="Gain Band 1", min=-48, max=18, init=0, rel="lin", unit="dB", col="purple2", half=True), |
| 83 |
cslider(name="thresh2", label="Threshold Band 2", min=-80, max=-0.1, init=-60, rel="lin", unit="dB", col="red1", half=True), |
| 84 |
cslider(name="gain2", label="Gain Band 2", min=-48, max=18, init=0, rel="lin", unit="dB", col="red2", half=True), |
| 85 |
cslider(name="thresh3", label="Threshold Band 3", min=-80, max=-0.1, init=-60, rel="lin", unit="dB", col="green1", half=True), |
| 86 |
cslider(name="gain3", label="Gain Band 3", min=-48, max=18, init=0, rel="lin", unit="dB", col="green2", half=True), |
| 87 |
cslider(name="thresh4", label="Threshold Band 4", min=-80, max=-0.1, init=-60, rel="lin", unit="dB", col="blue1", half=True), |
| 88 |
cslider(name="gain4", label="Gain Band 4", min=-48, max=18, init=0, rel="lin", unit="dB", col="blue2", half=True), |
| 89 |
cslider(name="gaterise", label="Rise Time", min=0.001, max=1, init=0.01, rel="lin", unit="sec", col="orange1"), |
| 90 |
cslider(name="gatefall", label="Fall Time", min=0.001, max=1, init=0.01, rel="lin", unit="sec", col="orange2"), |
| 91 |
cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue1"), |
| 92 |
cpoly() |
| 93 |
] |
| 94 |
|