| 1 |
class Module(BaseModule): |
| 2 |
""" |
| 3 |
"Arctangent distortion module with pre and post filters" |
| 4 |
|
| 5 |
Description |
| 6 |
|
| 7 |
This module applies an arctangent distortion with control on the amount |
| 8 |
of drive and pre/post filtering. |
| 9 |
|
| 10 |
Sliders |
| 11 |
|
| 12 |
# Pre Filter Freq : |
| 13 |
Center frequency of the filter applied before distortion |
| 14 |
# Pre Filter Q : |
| 15 |
Q factor of the filter applied before distortion |
| 16 |
# Pre Gain : |
| 17 |
Gain control applied before the distortion |
| 18 |
# Drive : |
| 19 |
Amount of distortion applied on the signal |
| 20 |
# Post Filter Freq : |
| 21 |
Center frequency of the filter applied after distortion |
| 22 |
# Post Filter Q : |
| 23 |
Q factor of the filter applied after distortion |
| 24 |
# Dry / Wet : |
| 25 |
Mix between the original signal and the degraded signal |
| 26 |
|
| 27 |
Graph Only |
| 28 |
|
| 29 |
# Overall Amplitude : |
| 30 |
The amplitude curve applied on the total duration of the performance |
| 31 |
|
| 32 |
Popups & Toggles |
| 33 |
|
| 34 |
# Pre Filter Type : |
| 35 |
Type of filter used before distortion |
| 36 |
# Post Filter Type : |
| 37 |
Type of filter used after distortion |
| 38 |
# Balance : |
| 39 |
Compression mode. Off, balanced with a fixed signal |
| 40 |
or balanced with the input source. |
| 41 |
# Polyphony Voices : |
| 42 |
Number of voices played simultaneously (polyphony), |
| 43 |
only available at initialization time |
| 44 |
# Polyphony Spread : |
| 45 |
Pitch variation between voices (chorus), |
| 46 |
only available at initialization time |
| 47 |
|
| 48 |
""" |
| 49 |
def __init__(self): |
| 50 |
BaseModule.__init__(self) |
| 51 |
self.snd = self.addSampler("snd") |
| 52 |
self.snd_filt = Biquadx(self.snd, freq=self.prefiltf, q=self.prefiltq, type=self.prefilttype_index, stages=2) |
| 53 |
self.input = Sig(self.snd_filt, mul=DBToA(self.pregain)) |
| 54 |
self.disto = Disto(self.input, drive=self.drv, slope=0, mul=.2) |
| 55 |
self.disto_filt = Biquadx(self.disto, freq=self.cut, q=self.q, stages=2, type=self.postfilttype_index) |
| 56 |
self.deg = Interp(self.snd, self.disto_filt, self.drywet, mul=self.env) |
| 57 |
|
| 58 |
self.osc = Sine(10000,mul=.1) |
| 59 |
self.balanced = Balance(self.deg, self.osc, freq=10) |
| 60 |
self.out = Interp(self.deg, self.balanced) |
| 61 |
|
| 62 |
#INIT |
| 63 |
self.balance(self.balance_index, self.balance_value) |
| 64 |
|
| 65 |
def balance(self,index,value): |
| 66 |
if index == 0: |
| 67 |
self.out.interp = 0 |
| 68 |
elif index == 1: |
| 69 |
self.out.interp = 1 |
| 70 |
self.balanced.input2 = self.osc |
| 71 |
elif index == 2: |
| 72 |
self.out.interp = 1 |
| 73 |
self.balanced.input2 = self.snd |
| 74 |
|
| 75 |
def prefilttype(self, index, value): |
| 76 |
self.snd_filt.type = index |
| 77 |
|
| 78 |
def postfilttype(self, index, value): |
| 79 |
self.out.type = index |
| 80 |
|
| 81 |
Interface = [ csampler(name="snd"), |
| 82 |
cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"), |
| 83 |
cslider(name="prefiltf", label="Pre Filter Freq", min=100, max=18000, init=250, rel="log", unit="Hz", col="green1"), |
| 84 |
cslider(name="prefiltq", label="Pre Filter Q", min=.5, max=10, init=0.707, rel="log", col="green2"), |
| 85 |
cslider(name="pregain", label="Pre Gain", min=-48, max=18, init=0, rel="lin", col="blue2"), |
| 86 |
cslider(name="drv", label="Drive", min=0.5, max=1, init=.9, rel="lin", col="purple1"), |
| 87 |
cslider(name="cut", label="Post Filter Freq", min=100, max=18000, init=5000, rel="log", col="green3"), |
| 88 |
cslider(name="q", label="Post Filter Q", min=.5, max=10, init=0.707, rel="log", col="green4"), |
| 89 |
cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue1"), |
| 90 |
cpopup(name="prefilttype", label="Pre Filter Type", init="Highpass", col="green1", value=["Lowpass","Highpass","Bandpass","Bandstop"]), |
| 91 |
cpopup(name="postfilttype", label="Post Filter Type", init="Lowpass", col="green3", value=["Lowpass","Highpass","Bandpass","Bandstop"]), |
| 92 |
cpopup(name="balance", label = "Balance", init= "Off", col="blue", value=["Off","Compress", "Source"]), |
| 93 |
cpoly() |
| 94 |
] |
| 95 |
|