Debian Codegraph @

Resources/modules/Multiband/MultiBandDelay.c5

raw
1 class Module(BaseModule):
2 """
3 "Multi-band delay with feedback"
4
5 Description
6
7 MultiBandDelay implements four separated spectral band delays
8 with independent delay time, gain and feedback.
9
10 Sliders
11
12 # Frequency Splitter :
13 Split points for multi-band processing
14 # Delay Band 1 :
15 Delay time for the first band
16 # Feedback Band 1 :
17 Amount of delayed signal fed back into the first band delay
18 # Gain Band 1 :
19 Gain of the delayed first band
20 # Delay Band 2 :
21 Delay time for the second band
22 # Feedback Band 2 :
23 Amount of delayed signal fed back into the second band delay
24 # Gain Band 2 :
25 Gain of the delayed second band
26 # Delay Band 3 :
27 Delay time for the third band
28 # Feedback Band 3 :
29 Amount of delayed signal fed back into the third band delay
30 # Gain Band 3 :
31 Gain of the delayed third band
32 # Delay Band 4 :
33 Delay time for the fourth band
34 # Feedback Band 4 :
35 Amount of delayed signal fed back into the fourth band delay
36 # Gain Band 4 :
37 Gain of the delayed 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.dels = self.duplicate([self.del1,self.del2,self.del3,self.del4], len(self.snd))
63 self.fbs = self.duplicate([self.fb1,self.fb2,self.fb3,self.fb4], 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.delay = Delay(input=self.split, delay=self.dels, feedback=self.fbs, maxdelay=15, mul=self.muls).mix(self.nchnls)
70 self.out = Interp(self.snd, self.delay, self.drywet, mul=0.5*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="blue"),
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="del1", label="Delay Band 1", min=0.0001, max=15, init=0.5, gliss=0.1, rel="log", unit="sec", half=True, col="purple1"),
86 cslider(name="del2", label="Delay Band 2", min=0.0001, max=15, init=0.25, gliss=0.1, rel="log", unit="sec", half=True, col="red1"),
87 cslider(name="fb1", label="Feedback Band 1", min=0, max=0.999, init=0.6, rel="lin", unit="x", half=True, col="purple2"),
88 cslider(name="fb2", label="Feedback Band 2", min=0, max=0.999, init=0.6, rel="lin", unit="x", half=True, col="red2"),
89 cslider(name="gain1", label="Gain Band 1", min=-48, max=18, init=0, rel="lin", unit="dB", half=True, col="purple3"),
90 cslider(name="gain2", label="Gain Band 2", min=-48, max=18, init=0, rel="lin", unit="dB", half=True, col="red3"),
91 cslider(name="del3", label="Delay Band 3", min=0.0001, max=15, init=0.33, gliss=0.1, rel="log", unit="sec", half=True, col="green1"),
92 cslider(name="del4", label="Delay Band 4", min=0.0001, max=15, init=0.66, gliss=0.1, rel="log", unit="sec", half=True, col="blue1"),
93 cslider(name="fb3", label="Feedback Band 3", min=0, max=0.999, init=0.6, rel="lin", unit="x", half=True, col="green2"),
94 cslider(name="fb4", label="Feedback Band 4", min=0, max=0.999, init=0.6, rel="lin", unit="x", half=True, col="blue2"),
95 cslider(name="gain3", label="Gain Band 3", min=-48, max=18, init=0, rel="lin", unit="dB", half=True, col="green3"),
96 cslider(name="gain4", label="Gain Band 4", min=-48, max=18, init=0, rel="lin", unit="dB", half=True, col="blue3"),
97 cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue"),
98 cpoly()
99 ]
100