Debian Codegraph @

Resources/modules/Multiband/MultiBandReverb.c5

raw
1 class Module(BaseModule):
2 """
3 "Multi-band reverberation module"
4
5 Description
6
7 MultiBandReverb implements four separated spectral band
8 harmonizers with independent reverb time, cutoff and gain.
9
10 Sliders
11
12 # Frequency Splitter :
13 Split points for multi-band processing
14 # Reverb Time 1 :
15 Amount of reverb (tail duration) applied on first band
16 # Lowpass Cutoff 1 :
17 Cutoff frequency of the reverb's lowpass filter (damp) for the first band
18 # Gain 1 :
19 Gain of the reverberized first band
20 # Reverb Time 2 :
21 Amount of reverb (tail duration) applied on second band
22 # Lowpass Cutoff 2 :
23 Cutoff frequency of the reverb's lowpass filter (damp) for the second band
24 # Gain 2 :
25 Gain of the reverberized second band
26 # Reverb Time 3 :
27 Amount of reverb (tail duration) applied on third band
28 # Lowpass Cutoff 3 :
29 Cutoff frequency of the reverb's lowpass filter (damp) for the third band
30 # Gain 3 :
31 Gain of the reverberized third band
32 # Reverb Time 4 :
33 Amount of reverb (tail duration) applied on fourth band
34 # Lowpass Cutoff 4 :
35 Cutoff frequency of the reverb's lowpass filter (damp) for the fourth band
36 # Gain 4 :
37 Gain of the reverberized fourth band
38 # Dry / Wet :
39 Mix between the original signal and the harmonized 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.fbs = self.duplicate([self.fb1,self.fb2,self.fb3,self.fb4], len(self.snd))
63 self.cutoffs = self.duplicate([self.cutoff1,self.cutoff2,self.cutoff3,self.cutoff4], len(self.snd))
64 self.mul1 = DBToA(self.gain1)
65 self.mul2 = DBToA(self.gain2)
66 self.mul3 = DBToA(self.gain3)
67 self.mul4 = DBToA(self.gain4)
68 self.muls = self.duplicate([self.mul1,self.mul2,self.mul3,self.mul4], len(self.snd))
69 self.verb = WGVerb(input=self.split, feedback=self.fbs, cutoff=self.cutoffs, bal=1, mul=self.muls)
70 self.verbs = self.verb.mix(self.nchnls)
71 self.out = Interp(self.snd, self.verbs, self.drywet, mul=self.env*0.5)
72
73 def splitter_up(self, value):
74 self.FBfade.value = 0
75 time.sleep(.02)
76 self.split.freq1 = value[0]
77 self.split.freq2 = value[1]
78 self.split.freq3 = value[2]
79 time.sleep(.02)
80 self.FBfade.value = 1
81
82 Interface = [ csampler(name="snd"),
83 cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"),
84 csplitter(name="splitter", label="Frequency Splitter", min=100, max=18000, init=[150, 500, 2000],
85 num_knobs=3, rel="log", gliss=0, up=True, unit="Hz", col="grey"),
86 cslider(name="fb1", label="Reverb Time 1", min=0, max=0.999, init=0.5, rel="lin", unit="x", col="purple1", half=True),
87 cslider(name="fb2", label="Reverb Time 2", min=0, max=0.999, init=0.75, rel="lin", unit="x", col="red1", half=True),
88 cslider(name="cutoff1", label="Lowpass Cutoff 1", min=20, max=20000, init=2500, rel="log", unit="Hz", col="purple2", half=True),
89 cslider(name="cutoff2", label="Lowpass Cutoff 2", min=20, max=20000, init=4000, rel="log", unit="Hz", col="red2", half=True),
90 cslider(name="gain1", label="Gain 1", min=-48, max=18, init=0, rel="lin", unit="dB", col="purple3", half=True),
91 cslider(name="gain2", label="Gain 2", min=-48, max=18, init=0, rel="lin", unit="dB", col="red3", half=True),
92 cslider(name="fb3", label="Reverb Time 3", min=0, max=0.999, init=0.85, rel="lin", unit="x", col="green1", half=True),
93 cslider(name="fb4", label="Reverb Time 4", min=0, max=0.999, init=0.65, rel="lin", unit="x", col="blue1", half=True),
94 cslider(name="cutoff3", label="Lowpass Cutoff 3", min=20, max=20000, init=5000, rel="log", unit="Hz", col="green2", half=True),
95 cslider(name="cutoff4", label="Lowpass Cutoff 4", min=20, max=20000, init=6000, rel="log", unit="Hz", col="blue2", half=True),
96 cslider(name="gain3", label="Gain 3", min=-48, max=18, init=0, rel="lin", unit="dB", col="green3", half=True),
97 cslider(name="gain4", label="Gain 4", min=-48, max=18, init=0, rel="lin", unit="dB", col="blue3", half=True),
98 cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=0.5, rel="lin", unit="x", col="blue1"),
99 cpoly()
100 ]
101