| 1 |
class Module(BaseModule): |
| 2 |
""" |
| 3 |
"State Variable Filter" |
| 4 |
|
| 5 |
Description |
| 6 |
|
| 7 |
This module implements lowpass, bandpass and highpass filters in parallel |
| 8 |
and allow the user to interpolate on an axis lp -> bp -> hp. |
| 9 |
|
| 10 |
Sliders |
| 11 |
|
| 12 |
# Filter Freq : |
| 13 |
Cutoff frequency for lp and hp (center freq for bp) |
| 14 |
# Filter Q : |
| 15 |
Q factor (inverse of bandwidth) of the filter |
| 16 |
# Type (lp->bp->hp) : |
| 17 |
Interpolating factor between filters |
| 18 |
# Dry / Wet : |
| 19 |
Mix between the original and the filtered signals |
| 20 |
|
| 21 |
Graph Only |
| 22 |
|
| 23 |
# Overall Amplitude : |
| 24 |
The amplitude curve applied on the total duration of the performance |
| 25 |
|
| 26 |
Popups & Toggles |
| 27 |
|
| 28 |
# Balance : |
| 29 |
Compression mode. Off, balanced with a fixed signal |
| 30 |
or balanced with the input source. |
| 31 |
# Polyphony Voices : |
| 32 |
Number of voices played simultaneously (polyphony), |
| 33 |
only available at initialization time |
| 34 |
# Polyphony Chords : |
| 35 |
Pitch interval between voices (chords), |
| 36 |
only available at initialization time |
| 37 |
|
| 38 |
""" |
| 39 |
def __init__(self): |
| 40 |
BaseModule.__init__(self) |
| 41 |
self.snd = self.addSampler("snd") |
| 42 |
self.dsp = SVF(self.snd, self.freq, self.q, self.type) |
| 43 |
self.deg = Interp(self.snd, self.dsp, self.drywet, mul=self.env) |
| 44 |
|
| 45 |
#BALANCE |
| 46 |
self.osc = Sine(10000, mul=.1) |
| 47 |
self.balanced = Balance(self.deg, self.osc, freq=10) |
| 48 |
self.out = Interp(self.deg, self.balanced) |
| 49 |
|
| 50 |
#INIT |
| 51 |
self.balance(self.balance_index, self.balance_value) |
| 52 |
|
| 53 |
def balance(self,index,value): |
| 54 |
if index == 0: |
| 55 |
self.out.interp = 0 |
| 56 |
elif index ==1: |
| 57 |
self.out.interp = 1 |
| 58 |
self.balanced.input2 = self.osc |
| 59 |
elif index == 2: |
| 60 |
self.out.interp = 1 |
| 61 |
self.balanced.input2 = self.snd |
| 62 |
|
| 63 |
Interface = [ |
| 64 |
csampler(name="snd"), |
| 65 |
cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"), |
| 66 |
cslider(name="freq", label="Filter Freq", min=20, max=20000, init=1000, rel="log", unit="Hz", col="green1"), |
| 67 |
cslider(name="q", label="Filter Q", min=0.5, max=25, init=1, rel="log", unit="x", col="green2"), |
| 68 |
cslider(name="type", label="Type (lp->bp->hp)", min=0, max=1, init=0.5, rel="lin", unit="x", col="green3"), |
| 69 |
cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue1"), |
| 70 |
cpopup(name="balance", label = "Balance", init= "Off", col="blue1", value=["Off","Compress", "Source"]), |
| 71 |
cpoly() |
| 72 |
] |
| 73 |
|