Debian Codegraph @

Resources/modules/Filters/ParamEQ.c5

raw
1 class Module(BaseModule):
2 """
3 "Parametric equalizer"
4
5 Description
6
7 Standard parametric equalizer built with four lowshelf/highshelf/peak/notch filters.
8
9 Sliders
10
11 # Freq 1 Boost/Cut :
12 Gain of the first EQ
13 # Freq 1 :
14 Center frequency of the first EQ
15 # Freq 1 Q :
16 Q factor of the first EQ
17 # Freq 2 Boost/Cut :
18 Gain of the second EQ
19 # Freq 2 :
20 Center frequency of the second EQ
21 # Freq 2 Q :
22 Q factor of the second EQ
23 # Freq 3 Boost/Cut :
24 Gain of the third EQ
25 # Freq 3 :
26 Center frequency of the third EQ
27 # Freq 3 Q :
28 Q factor of the third EQ
29 # Freq 5 Boost/Cut :
30 Gain of the fourth EQ
31 # Freq 4 :
32 Center frequency of the fourth EQ
33 # Freq 5 Q :
34 Q factor of the fourth EQ
35
36 Graph Only
37
38 # Overall Amplitude :
39 The amplitude curve applied on the total duration of the performance
40
41 Popups & Toggles
42
43 # EQ Type 1 :
44 EQ type of the first EQ
45 # EQ Type 2 :
46 EQ type of the second EQ
47 # EQ Type 3 :
48 EQ type of the third EQ
49 # EQ Type 4 :
50 EQ type of the fourth EQ
51 # Balance :
52 Compression mode. Off, balanced with a fixed signal
53 or balanced with the input source.
54 # Polyphony Voices :
55 Number of voices played simultaneously (polyphony),
56 only available at initialization time
57 # Polyphony Spread :
58 Pitch variation between voices (chorus),
59 only available at initialization time
60
61 """
62 def __init__(self):
63 BaseModule.__init__(self)
64 self.snd = self.addSampler("snd")
65 self.eq1 = EQ(self.snd, freq=self.freq1, q=self.freq1q, boost=self.freq1gain, type=self.eq1type_index)
66 self.eq2 = EQ(self.eq1, freq=self.freq2, q=self.freq2q, boost=self.freq2gain, type=self.eq2type_index)
67 self.eq3 = EQ(self.eq2, freq=self.freq3, q=self.freq3q, boost=self.freq3gain, type=self.eq3type_index)
68 self.eq4 = EQ(self.eq3, freq=self.freq4, q=self.freq4q, boost=self.freq4gain, type=self.eq4type_index, mul=self.env)
69
70 self.osc = Sine(10000,mul=.1)
71 self.balanced = Balance(self.eq4, self.osc, freq=10)
72 self.out = Interp(self.eq4, self.balanced)
73
74 #INIT
75 self.balance(self.balance_index, self.balance_value)
76
77 def eq1type(self, index, value):
78 self.eq1.type = index
79
80 def eq2type(self, index, value):
81 self.eq2.type = index
82
83 def eq3type(self, index, value):
84 self.eq3.type = index
85
86 def eq4type(self, index, value):
87 self.eq4.type = index
88
89 def balance(self,index,value):
90 if index == 0:
91 self.out.interp = 0
92 elif index == 1:
93 self.out.interp= 1
94 self.balanced.input2 = self.osc
95 elif index == 2:
96 self.out.interp = 1
97 self.balanced.input2 = self.snd
98
99 Interface = [ csampler(name="snd"),
100 cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue"),
101 cslider(name="freq1gain", label="Freq 1 Boost/Cut", min=-48, max=24, init=-3, rel="lin", unit="dB", col="purple1"),
102 cslider(name="freq1", label="Freq 1", min=1, max=20000, init=500, rel="log", unit="Hz", col="purple1", half=True),
103 cslider(name="freq1q", label="Freq 1 Q", min=0.5, max=10, init=0.707, rel="lin", unit="x", col="purple1",half=True),
104 cslider(name="freq2gain", label="Freq 2 Boost/Cut", min=-48, max=24, init=-3, rel="lin", unit="dB", col="red"),
105 cslider(name="freq2", label="Freq 2", min=1, max=20000, init=1000, rel="log", unit="Hz", col="red", half=True),
106 cslider(name="freq2q", label="Freq 2 Q", min=0.5, max=10, init=0.707, rel="lin", unit="x", col="red", half=True),
107 cslider(name="freq3gain", label="Freq 3 Boost/Cut", min=-48, max=24, init=-3, rel="lin", unit="dB", col="blue1"),
108 cslider(name="freq3", label="Freq 3", min=1, max=20000, init=1500, rel="log", unit="Hz", col="blue1", half=True),
109 cslider(name="freq3q", label="Freq 3 Q", min=0.5, max=10, init=0.707, rel="lin", unit="x", col="blue1", half=True),
110 cslider(name="freq4gain", label="Freq 4 Boost/Cut", min=-48, max=24, init=-3, rel="lin", unit="dB", col="green1"),
111 cslider(name="freq4", label="Freq 4", min=1, max=20000, init=2000, rel="log", unit="Hz", col="green1", half=True),
112 cslider(name="freq4q", label="Freq 4 Q", min=0.5, max=10, init=0.707, rel="lin", unit="x", col="green1", half=True),
113 cpopup(name="eq1type", label="EQ 1 Type", init="Lowshelf", col="purple1", value=["Peak/Notch", "Lowshelf", "Highshelf"]),
114 cpopup(name="eq2type", label="EQ 2 Type", init="Peak/Notch", col="red", value=["Peak/Notch", "Lowshelf", "Highshelf"]),
115 cpopup(name="eq3type", label="EQ 3 Type", init="Peak/Notch", col="blue1", value=["Peak/Notch", "Lowshelf", "Highshelf"]),
116 cpopup(name="eq4type", label="EQ 4 Type", init="Highshelf", col="green1", value=["Peak/Notch", "Lowshelf", "Highshelf"]),
117 cpopup(name="balance", label = "Balance", init= "Off", col="blue", value=["Off","Compress", "Source"]),
118 cpoly()
119 ]
120