Debian Codegraph @

Resources/modules/Pitch/LooperBank.c5

raw
1 class Module(BaseModule):
2 """
3 "Sound looper bank with independant pitch and amplitude random"
4
5 Description
6
7 Huge oscillator bank (up to 500 players) looping a soundfile stored in a waveform
8 table. The frequencies and amplitudes can be modulated by two random generators
9 with interpolation (each partial have a different set of randoms).
10
11 Sliders
12
13 # Transposition :
14 Transposition of the base frequency of the process, given by the sound length.
15 # Frequency Spread :
16 Coefficient of expansion used to compute partial frequencies. If 0, all
17 partials will be at the base frequency. A value of 1 will generate integer
18 harmonics, a value of 2 will skip even harmonics and non-integer values will
19 generate different series of inharmonic frequencies.
20 # Amplitude Slope :
21 Specifies the multiplier in the series of amplitude coefficients.
22 # Boost / Cut :
23 Controls the overall amplitude.
24 # Freq Rand Speed :
25 Frequency, in cycle per second, of the frequency modulations.
26 # Freq Rand Gain :
27 Maximum frequency deviation (positive and negative) in portion of the partial
28 frequency. A value of 1 means that the frequency can drift from 0 Hz to twice
29 the partial frequency. A value of 0 deactivates the frequency deviations.
30 # Amp Rand Speed :
31 Frequency, in cycle per second, of the amplitude modulations.
32 # Amp Rand Gain :
33 Amount of amplitude deviation. 0 deactivates the amplitude modulations
34 and 1 gives full amplitude modulations.
35 # Voices Per Channel :
36 Number of loopers created for each output channel. Changes will be
37 effective on next start.
38
39 Graph Only
40
41 # Overall Amplitude :
42 The amplitude curve applied on the total duration of the performance
43
44 Popups & Toggles
45
46 # Partials Freq Jitter :
47 If active, a small jitter is added to the frequency of each partial. For a
48 large number of oscillators and a very small `Frequency Spread`, the
49 periodicity between partial frequencies can cause very strange artefact.
50 Adding a jitter breaks the periodicity.
51
52 """
53 def __init__(self):
54 BaseModule.__init__(self)
55 self.snd = self.addFilein("snd")
56 self.gain = DBToA(self.boost, mul=self.env)
57 self.transpo = CentsToTranspo(self.pitch, mul=self.snd.getRate())
58 self.out = OscBank(self.snd, self.transpo, self.spread, self.slope, self.frndf, self.frnda, self.arndf, self.arnda,
59 [int(self.num.get())]*self.nchnls, self.fjit_value, self.gain).out()
60
61 def num_up(self, value):
62 pass
63
64 def fjit(self, value):
65 self.out.fjit = value
66
67 Interface = [ cfilein(name="snd"),
68 cgraph(name="env", label="Overall Amplitude", func=[(0,1),(1,1)], col="blue1"),
69 cslider(name="pitch", label="Transposition", min=-4800, max=4800, init=0, rel="lin", unit="cnts", col="green1"),
70 cslider(name="spread", label="Frequency Spread", min=0, max=2, init=0.002, rel="lin", unit="x", col="green2"),
71 cslider(name="slope", label="Amplitude Slope", min=0, max=1, init=0.9, rel="lin", unit="x", col="red1"),
72 cslider(name="boost", label="Boost / Cut", min=-32, max=32, init=0, rel="lin", unit="dB", col="red2"),
73 cslider(name="frndf", label="Freq Rand Speed", min=0.001, max=20, init=1, rel="log", unit="Hz", col="green3", half=True),
74 cslider(name="arndf", label="Amp Rand Speed", min=0.001, max=20, init=1, rel="log", unit="Hz", col="red3", half=True),
75 cslider(name="frnda", label="Freq Rand Gain", min=0, max=1, init=0, rel="lin", unit="x", col="green4", half=True),
76 cslider(name="arnda", label="Amp Rand Gain", min=0, max=1, init=0, rel="lin", unit="x", col="red4", half=True),
77 cslider(name="num", label="Voices Per Channel", min=1, max=500, init=100, rel="lin", res="int", unit="x", up=True),
78 ctoggle(name="fjit", label="Partials Freq Jitter", init=False, col="green1"),
79 ]