Debian Codegraph @

Resources/modules/Pitch/PitchLooper.c5

raw
1 class Module(BaseModule):
2 """
3 "Table-based transposition module with multiple voices"
4
5 Description
6
7 This module implements five sound loopers playing in parallel.
8 Loopers are table-based so a change in pitch will produce a
9 change in sound duration. This can be useful to create rhythm
10 effects as well as harmonic effects.
11
12 Sliders
13
14 # Transpo Voice 1 :
15 Playback speed of the first voice
16 # Gain Voice 1 :
17 Gain of the transposed first voice
18 # Transpo Voice 2 :
19 Playback speed of the second voice
20 # Gain Voice 2 :
21 Gain of the transposed second voice
22 # Transpo Voice 3 :
23 Playback speed of the third voice
24 # Gain Voice 3 :
25 Gain of the transposed third voice
26 # Transpo Voice 4 :
27 Playback speed of the fourth voice
28 # Gain Voice 4 :
29 Gain of the transposed fourth voice
30 # Transpo Voice 5 :
31 Playback speed of the fifth voice
32 # Gain Voice 5 :
33 Gain of the transposed fifth voice
34
35 Graph Only
36
37 # Overall Amplitude :
38 The amplitude curve applied on the total duration of the performance
39
40 Popups & Toggles
41
42 # Voice Activation 1 --> 5 :
43 Mute or unmute each voice independently
44 # Polyphony Voices :
45 Number of voices played simultaneously (polyphony),
46 only available at initialization time
47 # Polyphony Spread :
48 Pitch variation between voices (chorus),
49 only available at initialization time
50
51 """
52 def __init__(self):
53 BaseModule.__init__(self)
54 self.snd = self.addFilein("snd")
55 self.factor1 = CentsToTranspo(self.transpo1)
56 self.factor2 = CentsToTranspo(self.transpo2)
57 self.factor3 = CentsToTranspo(self.transpo3)
58 self.factor4 = CentsToTranspo(self.transpo4)
59 self.factor5 = CentsToTranspo(self.transpo5)
60 self.phasor1 = Phasor(self.snd.getRate()*self.factor1)
61 self.phasor2 = Phasor(self.snd.getRate()*self.factor2)
62 self.phasor3 = Phasor(self.snd.getRate()*self.factor3)
63 self.phasor4 = Phasor(self.snd.getRate()*self.factor4)
64 self.phasor5 = Phasor(self.snd.getRate()*self.factor5)
65 self.mul1 = DBToA(self.gain1, mul=self.onoffv1_value)
66 self.mul2 = DBToA(self.gain2, mul=self.onoffv2_value)
67 self.mul3 = DBToA(self.gain3, mul=self.onoffv3_value)
68 self.mul4 = DBToA(self.gain4, mul=self.onoffv4_value)
69 self.mul5 = DBToA(self.gain5, mul=self.onoffv5_value)
70 self.voice1 = Pointer(self.snd, self.phasor1, mul=self.mul1*0.2)
71 self.voice2 = Pointer(self.snd, self.phasor2, mul=self.mul2*0.2)
72 self.voice3 = Pointer(self.snd, self.phasor3, mul=self.mul3*0.2)
73 self.voice4 = Pointer(self.snd, self.phasor4, mul=self.mul4*0.2)
74 self.voice5 = Pointer(self.snd, self.phasor5, mul=self.mul5*0.2)
75 self.mixxx = self.voice1+self.voice2+self.voice3+self.voice4+self.voice5
76 self.out = self.mixxx*self.env
77
78 def onoffv1(self, value):
79 self.mul1.mul = value
80
81 def onoffv2(self, value):
82 self.mul2.mul = value
83
84 def onoffv3(self, value):
85 self.mul3.mul = value
86
87 def onoffv4(self, value):
88 self.mul4.mul = value
89
90 def onoffv5(self, value):
91 self.mul5.mul = value
92
93 Interface = [ cfilein(name="snd"),
94 cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue"),
95 cslider(name="transpo1", label="Transpo Voice 1", min=-4800, max=4800, init=0, rel="lin", unit="cnts", col="green",half=True),
96 cslider(name="gain1", label="Gain Voice 1", min=-48, max=18, init=0, rel="lin", unit="dB", col="green",half=True),
97 cslider(name="transpo2", label="Transpo Voice 2", min=-4800, max=4800, init=10, rel="lin", unit="cnts", col="blue",half=True),
98 cslider(name="gain2", label="Gain Voice 2", min=-48, max=18, init=0, rel="lin", unit="dB", col="blue",half=True),
99 cslider(name="transpo3", label="Transpo Voice 3", min=-4800, max=4800, init=400, rel="lin", unit="cnts", col="orange",half=True),
100 cslider(name="gain3", label="Gain Voice 3", min=-48, max=18, init=0, rel="lin", unit="dB", col="orange",half=True),
101 cslider(name="transpo4", label="Transpo Voice 4", min=-4800, max=4800, init=-300, rel="lin", unit="cnts", col="blue4",half=True),
102 cslider(name="gain4", label="Gain Voice 4", min=-48, max=18, init=0, rel="lin", unit="dB", col="blue4",half=True),
103 cslider(name="transpo5", label="Transpo Voice 5", min=-4800, max=4800, init=-800, rel="lin", unit="cnts", col="green4",half=True),
104 cslider(name="gain5", label="Gain Voice 5", min=-48, max=18, init=0, rel="lin", unit="dB", col="green4",half=True),
105 ctoggle(name="onoffv1", label="Voice Activation 1 --> 5", init=1, stack=True, col="green"),
106 ctoggle(name="onoffv2", label="", init=1, stack=True, col="green"),
107 ctoggle(name="onoffv3", label="", init=1, stack=True, col="green"),
108 ctoggle(name="onoffv4", label="", init=1, stack=True, col="green"),
109 ctoggle(name="onoffv5", label="", init=1, stack=True, col="green"),
110 ]