Debian Codegraph @

Resources/modules/Spectral/Vectral.c5

raw
1 class Module(BaseModule):
2 """
3 "Phase Vocoder based vectral module (spectral gate and verb)"
4
5 Description
6
7 This module implements a spectral gate followed by a spectral reverb.
8
9 Sliders
10
11 # Gate Threshold :
12 dB value at which the gate becomes active
13 # Gate Attenuation :
14 Gain in dB of the gated signal
15 # Time Factor :
16 Filter coefficient for decreasing bins
17 # High Freq Damping :
18 High frequencies damping factor
19 # Dry / Wet :
20 Mix between the original signal and the delayed signals
21
22 Graph Only
23
24 # Overall Amplitude :
25 The amplitude curve applied on the total duration of the performance
26
27 Popups & Toggles
28
29 # FFT Size :
30 Size, in samples, of the FFT
31 # FFT Envelope :
32 Windowing shape of the FFT
33 # FFT Overlaps :
34 Number of FFT overlaping analysis
35 # Polyphony Voices :
36 Number of voices played simultaneously (polyphony),
37 only available at initialization time
38 # Polyphony Spread :
39 Pitch variation between voices (chorus),
40 only available at initialization time
41
42 """
43 def __init__(self):
44 BaseModule.__init__(self)
45 self.snd = self.addSampler("snd")
46
47 size = int(self.fftsize_value)
48 olaps = int(self.overlaps_value)
49 wintype = self.wtype_index
50 self.oneOverSr = 1.0 / self.sr
51
52 self.delsrc = Delay(self.snd, delay=size*self.oneOverSr)
53
54 self.fin = PVAnal(self.snd, size=size, overlaps=olaps, wintype=wintype)
55 self.gate = PVGate(self.fin, self.gthresh, DBToA(self.gatt))
56 self.vect = PVVerb(self.gate, self.downfac, self.damp)
57 self.fout = PVSynth(self.vect, wintype=wintype, mul=self.env)
58
59 self.fade = SigTo(value=1, time=.05, init=1)
60 self.out = Interp(self.delsrc*self.env, self.fout, self.mix, mul=self.fade)
61
62 def fftsize(self, index, value):
63 newsize = int(value)
64 self.fade.value = 0
65 time.sleep(.05)
66 self.delsrc.delay = newsize*self.oneOverSr
67 self.fin.size = newsize
68 time.sleep(.05)
69 self.fade.value = 1
70
71 def overlaps(self, index, value):
72 olaps = int(value)
73 self.fade.value = 0
74 time.sleep(.05)
75 self.fin.overlaps = olaps
76 time.sleep(.05)
77 self.fade.value = 1
78
79 def wtype(self, index, value):
80 self.fin.wintype = index
81 self.fout.wintype = index
82
83 Interface = [ csampler(name="snd"),
84 cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue"),
85 cslider(name="gthresh", label="Gate Threshold", min=-120, max=0, init=-30, rel="lin", unit="db", col="red"),
86 cslider(name="gatt", label="Gate Attenuation", min=-120, max=0, init=-120, rel="lin", unit="db", col="red"),
87 cslider(name="downfac", label="Time Factor", min=0, max=1, init=0.3, rel="lin", unit="x", col="orange"),
88 cslider(name="damp", label="High Freq Damping", min=0, max=1, init=0.9, rel="lin", unit="x", col="green"),
89 cslider(name="mix", label="Dry / Wet", min=0, max=1, init=1, rel="lin", unit="x", col="blue"),
90 cpopup(name="fftsize", label="FFT Size", init="1024", value=["16", "32", "64", "128", "256", "512", "1024", "2048", "4096", "8192"], col="red"),
91 cpopup(name="wtype", label="FFT Envelope", init="Hanning", col="red", value=["Rectangular", "Hamming", "Hanning", "Bartlett",
92 "Blackman 3", "Blackman 4", "Blackman 7", "Tuckey", "Sine"]),
93 cpopup(name="overlaps", label="FFT Overlaps", init="4", value=["1", "2", "4", "8", "16"]),
94 cpoly()
95 ]
96