Debian Codegraph @

Resources/modules/Dynamics/WaveShaper.c5

raw
1 class Module(BaseModule):
2 """
3 "Table lookup waveshaping module"
4
5 Description
6
7 This module applies a waveshaping-based distortion on the input sound.
8 It allows the user to draw the transfert function on the screen.
9
10 Sliders
11
12 # Filter Freq :
13 Center frequency of the post-process filter
14 # Filter Q :
15 Q factor of the post-process filter
16 # Dry / Wet :
17 Mix between the original signal and the degraded signal
18
19 Graph Only
20
21 # Overall Amplitude :
22 The amplitude curve applied on the total duration of the performance
23 # Transfer Function :
24 Table used as transfert function for waveshaping
25
26 Popups & Toggles
27
28 # Filter Type :
29 Type of the post-process filter
30 # Polyphony Voices :
31 Number of voices played simultaneously (polyphony),
32 only available at initialization time
33 # Polyphony Spread :
34 Pitch variation between voices (chorus),
35 only available at initialization time
36
37 """
38 def __init__(self):
39 BaseModule.__init__(self)
40 self.snd = self.addSampler("snd")
41 self.lookup = Lookup(self.function, self.snd)
42 self.lookdc = DCBlock(self.lookup, mul=0.4)
43 self.filt = Biquadx(self.lookdc, freq=self.cut, q=self.filterq, type=self.filttype_index, stages=3)
44 self.out = Interp(self.snd, self.filt, self.drywet, mul=self.env)
45
46 def filttype(self, index, value):
47 self.out.type = index
48
49 Interface = [ csampler(name="snd"),
50 cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"),
51 cgraph(name="function", label="Transfer Function", func=[(0,1),(0.5,1),(0.501,0),(1,0)], table=True, col="orange1"),
52 cslider(name="cut", label="Filter Freq", min=100, max=18000, init=7000, rel="log", unit="Hz", col="green1"),
53 cslider(name="filterq", label="Filter Q", min=0.5, max=10, init=0.707, rel="log", unit="Q", col="green2"),
54 cslider(name="drywet", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue1"),
55 cpopup(name="filttype", label="Filter Type", init="Lowpass", col="green1", value=["Lowpass","Highpass","Bandpass","Bandstop"]),
56 cpoly()
57 ]
58