| 1 |
class Module(BaseModule): |
| 2 |
""" |
| 3 |
"Multi-band distortion module" |
| 4 |
|
| 5 |
Description |
| 6 |
|
| 7 |
MultiBandDisto implements four separated spectral band distortions |
| 8 |
with independent drive, slope and gain. |
| 9 |
|
| 10 |
Sliders |
| 11 |
|
| 12 |
# Frequency Splitter : |
| 13 |
Split points for multi-band processing |
| 14 |
# Band 1 Drive : |
| 15 |
Amount of distortion applied on the first band |
| 16 |
# Band 1 Slope : |
| 17 |
Harshness of distorted first band |
| 18 |
# Band 1 Gain : |
| 19 |
Gain of the distorted first band |
| 20 |
# Band 2 Drive : |
| 21 |
Amount of distortion applied on the second band |
| 22 |
# Band 2 Slope : |
| 23 |
Harshness of distorted second band |
| 24 |
# Band 2 Gain : |
| 25 |
Gain of the distorted second band |
| 26 |
# Band 3 Drive : |
| 27 |
Amount of distortion applied on the third band |
| 28 |
# Band 3 Slope : |
| 29 |
Harshness of distorted third band |
| 30 |
# Band 3 Gain : |
| 31 |
Gain of the distorted third band |
| 32 |
# Band 4 Drive : |
| 33 |
Amount of distortion applied on the fourth band |
| 34 |
# Band 4 Slope : |
| 35 |
Harshness of distorted fourth band |
| 36 |
# Band 4 Gain : |
| 37 |
Gain of the distorted fourth band |
| 38 |
# Dry / Wet : |
| 39 |
Mix between the original signal and the delayed signals |
| 40 |
|
| 41 |
Graph Only |
| 42 |
|
| 43 |
# Overall Amplitude : |
| 44 |
The amplitude curve applied on the total duration of the performance |
| 45 |
|
| 46 |
Popups & Toggles |
| 47 |
|
| 48 |
# Polyphony Voices : |
| 49 |
Number of voices played simultaneously (polyphony), |
| 50 |
only available at initialization time |
| 51 |
# Polyphony Spread : |
| 52 |
Pitch variation between voices (chorus), |
| 53 |
only available at initialization time |
| 54 |
|
| 55 |
""" |
| 56 |
def __init__(self): |
| 57 |
BaseModule.__init__(self) |
| 58 |
self.snd = self.addSampler("snd") |
| 59 |
freqs = self.splitter.get(True) |
| 60 |
self.FBfade = SigTo(value=1, time=.01, init=1) |
| 61 |
self.split = FourBand(input=self.snd, freq1=freqs[0], freq2=freqs[1], freq3=freqs[2], mul=self.FBfade) |
| 62 |
self.drives = self.duplicate([self.drive1,self.drive2,self.drive3,self.drive4], len(self.snd)) |
| 63 |
self.slopes = self.duplicate([self.drive1slope,self.drive2slope,self.drive3slope,self.drive4slope], len(self.snd)) |
| 64 |
self.mul1 = DBToA(self.drive1mul) |
| 65 |
self.mul2 = DBToA(self.drive2mul) |
| 66 |
self.mul3 = DBToA(self.drive3mul) |
| 67 |
self.mul4 = DBToA(self.drive4mul) |
| 68 |
self.muls = self.duplicate([self.mul1,self.mul2,self.mul3,self.mul4], len(self.snd)) |
| 69 |
self.disto = Disto(input=self.split, drive=self.drives, slope=self.slopes, mul=[i*0.1 for i in self.muls]).mix(self.nchnls) |
| 70 |
self.out = Interp(self.snd, self.disto, self.drywet, mul=self.env) |
| 71 |
|
| 72 |
def splitter_up(self, value): |
| 73 |
self.FBfade.value = 0 |
| 74 |
time.sleep(.02) |
| 75 |
self.split.freq1 = value[0] |
| 76 |
self.split.freq2 = value[1] |
| 77 |
self.split.freq3 = value[2] |
| 78 |
time.sleep(.02) |
| 79 |
self.FBfade.value = 1 |
| 80 |
|
| 81 |
Interface = [ csampler(name="snd"), |
| 82 |
cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"), |
| 83 |
csplitter(name="splitter", label="Frequency Splitter", min=100, max=18000, init=[150, 500, 2000], |
| 84 |
num_knobs=3, rel="log", gliss=0, up=True, unit="Hz", col="grey"), |
| 85 |
cslider(name="drive1", label="Band 1 Drive", min=0, max=1, init=0.5, rel="lin", unit="x", col="purple1", half=True), |
| 86 |
cslider(name="drive2", label="Band 2 Drive", min=0, max=1, init=0.95, rel="lin", unit="x", col="red1", half=True), |
| 87 |
cslider(name="drive1slope", label="Band 1 Slope", min=0, max=1, init=0.85, rel="lin", unit="x", col="purple2", half=True), |
| 88 |
cslider(name="drive2slope", label="Band 2 Slope", min=0, max=1, init=0.8, rel="lin", unit="x", col="red2", half=True), |
| 89 |
cslider(name="drive1mul", label="Band 1 Gain", min=-48, max=18, init=0, rel="lin", unit="dB", col="purple3", half=True), |
| 90 |
cslider(name="drive2mul", label="Band 2 Gain", min=-48, max=18, init=0, rel="lin", unit="dB", col="red3", half=True), |
| 91 |
cslider(name="drive3", label="Band 3 Drive", min=0, max=1, init=0.75, rel="lin", unit="x", col="green1", half=True), |
| 92 |
cslider(name="drive4", label="Band 4 Drive", min=0, max=1, init=0.5, rel="lin", unit="x", col="blue1", half=True), |
| 93 |
cslider(name="drive3slope", label="Band 3 Slope", min=0, max=1, init=0.75, rel="lin", unit="x", col="green2", half=True), |
| 94 |
cslider(name="drive4slope", label="Band 4 Slope", min=0, max=1, init=0.5, rel="lin", unit="x", col="blue2", half=True), |
| 95 |
cslider(name="drive3mul", label="Band 3 Gain", min=-48, max=18, init=0, rel="lin", unit="dB", col="green3", half=True), |
| 96 |
cslider(name="drive4mul", label="Band 4 Gain", min=-48, max=18, init=0, rel="lin", unit="dB", col="blue3", half=True), |
| 97 |
cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue1"), |
| 98 |
cpoly() |
| 99 |
] |
| 100 |
|