Debian Codegraph @

Resources/modules/Multiband/MultiBandFreqShift.c5

raw
1 class Module(BaseModule):
2 """
3 "Multi-band frequency shifter module"
4
5 Description
6
7 MultiBandFreqShift implements four separated spectral band
8 frequency shifters with independent amount of shift and gain.
9
10 Sliders
11
12 # Frequency Splitter :
13 Split points for multi-band processing
14 # Freq Shift Band 1 :
15 Shift frequency of first band
16 # Gain Band 1 :
17 Gain of the shifted first band
18 # Freq Shift Band 2 :
19 Shift frequency of second band
20 # Gain Band 2 :
21 Gain of the shifted second band
22 # Freq Shift Band 3 :
23 Shift frequency of third band
24 # Gain Band 3 :
25 Gain of the shifted third band
26 # Freq Shift Band 4 :
27 Shift frequency of fourth band
28 # Gain Band 5 :
29 Gain of the shifted fourth band
30 # Dry / Wet :
31 Mix between the original signal and the shifted signals
32
33 Graph Only
34
35 # Overall Amplitude :
36 The amplitude curve applied on the total duration of the performance
37
38 Popups & Toggles
39
40 # Polyphony Voices :
41 Number of voices played simultaneously (polyphony),
42 only available at initialization time
43 # Polyphony Spread :
44 Pitch variation between voices (chorus),
45 only available at initialization time
46
47 """
48 def __init__(self):
49 BaseModule.__init__(self)
50 self.snd = self.addSampler("snd")
51 freqs = self.splitter.get(True)
52 self.FBfade = SigTo(value=1, time=.01, init=1)
53 self.split = FourBand(input=self.snd, freq1=freqs[0], freq2=freqs[1], freq3=freqs[2], mul=self.FBfade)
54 self.shifts = self.duplicate([self.shift1,self.shift2,self.shift3,self.shift4], len(self.snd))
55 self.mul1 = DBToA(self.gain1)
56 self.mul2 = DBToA(self.gain2)
57 self.mul3 = DBToA(self.gain3)
58 self.mul4 = DBToA(self.gain4)
59 self.muls = self.duplicate([self.mul1,self.mul2,self.mul3,self.mul4], len(self.snd))
60 self.realups = FreqShift(self.split, self.shifts, self.muls)
61 self.out = Interp(self.snd, self.realups, self.drywet, mul=self.env*0.2)
62
63 def splitter_up(self, value):
64 self.FBfade.value = 0
65 time.sleep(.02)
66 self.split.freq1 = value[0]
67 self.split.freq2 = value[1]
68 self.split.freq3 = value[2]
69 time.sleep(.02)
70 self.FBfade.value = 1
71
72 Interface = [ csampler(name="snd"),
73 cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"),
74 csplitter(name="splitter", label="Frequency Splitter", min=100, max=18000, init=[150, 500, 2000],
75 num_knobs=3, rel="log", gliss=0, up=True, unit="Hz", col="grey"),
76 cslider(name="shift1", label="Freq Shift Band 1", min=-2000, max=2000, init=600, rel="lin", unit="Hz", col="purple1", half=True),
77 cslider(name="gain1", label="Gain Band 1", min=-48, max=18, init=0, rel="lin", unit="dB", col="purple2", half=True),
78 cslider(name="shift2", label="Freq Shift Band 2", min=-2000, max=2000, init=500, rel="lin", unit="Hz", col="red1", half=True),
79 cslider(name="gain2", label="Gain Band 2", min=-48, max=18, init=0, rel="lin", unit="dB", col="red2", half=True),
80 cslider(name="shift3", label="Freq Shift Band 3", min=-2000, max=2000, init=400, rel="lin", unit="Hz", col="green1", half=True),
81 cslider(name="gain3", label="Gain Band 3", min=-48, max=18, init=0, rel="lin", unit="dB", col="green2", half=True),
82 cslider(name="shift4", label="Freq Shift Band 4", min=-2000, max=2000, init=300, rel="lin", unit="Hz", col="orange1", half=True),
83 cslider(name="gain4", label="Gain Band 4", min=-48, max=18, init=0, rel="lin", unit="dB", col="orange2", half=True),
84 cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue1"),
85 cpoly()
86 ]
87