2 summary:: Dynamic stochastic synthesis generator.
3 related:: Classes/Gendy2, Classes/Gendy3
4 categories:: UGens>Generators>Stochastic
9 An implementation of the dynamic stochastic synthesis generator conceived
10 by Iannis Xenakis and described in emphasis::Formalized Music (1992, Stuyvesant, NY: Pendragon Press) chapter 9 (pp 246-254) and chapters 13 and 14 (pp 289-322)::.
12 The BASIC program in the book was written by Marie-Helene Serra so I
13 think it helpful to credit her too.
15 The program code has been adapted to avoid infinities in the probability
16 distribution functions.
18 The distributions are hard-coded in C but there is an option to have new
19 amplitude or time breakpoints sampled from a continuous controller input.
21 subsection:: Technical notes
22 X's plan as described in chapter 13 allows the 12 segments in the period to be successively modified with each new period.
23 Yet the period is allowed to vary as the sum of the segment durations, as figure 1 demonstrates.
24 We can setup some memory of n (conventionally 12) points, or even simply vary successively a single point's ordinate and
25 duration. There are thus various schemes available to us. In one, fix period T and only move the (ti, Ei) within the period. In another, have a memory of 12 segments but allow continuous modification of the inter point intervals and the amplitudes.
26 In yet another, just have one point and random walk its amplitude and duration based on the probability distribution.
27 In this implementation I allow the user to initialise a certain number of memory points which is up to them.
28 To restrict the period to be unchanging, you must set rate variation to zero (dscale=0).
30 SuperCollider implementation by Nick Collins.
39 Choice of probability distribution for the next perturbation of
40 the amplitude of a control point.
42 The distributions are (adapted from the GENDYN program in Formalized Music):
54 Where the sinus (Xenakis' name) is in this implementation taken
55 as sampling from a third party oscillator. See example below.
60 Choice of distribution for the perturbation of the current inter
61 control point duration.
66 A parameter for the shape of the amplitude probability
67 distribution, requires values in the range 0.0001 to 1 (there are
68 safety checks in the code so don't worry too much if you want to
74 A parameter for the shape of the duration probability
75 distribution, requires values in the range 0.0001 to 1.
80 Minimum allowed frequency of oscillation for the Gendy1
81 oscillator, so gives the largest period the duration is allowed
87 Maximum allowed frequency of oscillation for the Gendy1
88 oscillator, so gives the smallest period the duration is allowed
94 Normally 0.0 to 1.0, multiplier for the distribution's delta
95 value for amplitude. An ampscale of 1.0 allows the full range
96 of -1 to 1 for a change of amplitude.
101 Normally 0.0 to 1.0, multiplier for the distribution's delta
102 value for duration. An ampscale of 1.0 allows the full range of
103 -1 to 1 for a change of duration.
108 Initialise the number of control points in the memory.
109 Xenakis specifies 12. There would be this number of control
110 points per cycle of the oscillator, though the oscillator's
111 period will constantly change due to the duration distribution.
116 Current number of utilised control points, allows modulation.
123 All parameters can be modulated at control rate except for code::initCPs:: which is used only at initialisation.
128 if you have lots of CPs and you have fast frequencies, the CPU cost goes up a lot because a new CP move happens every sample!
133 {Pan2.ar(Gendy1.ar)}.play
135 //wandering bass/ powerline
136 {Pan2.ar(Gendy1.ar(1,1,1.0,1.0,30,100,0.3,0.05,5))}.play
139 {Pan2.ar(RLPF.ar(Gendy1.ar(2,3,minfreq:20,maxfreq:MouseX.kr(100,1000),durscale:0.0,initCPs:40),500,0.3,0.2),0.0)}.play
141 //scream! - careful with your ears for this one!
146 mx= MouseX.kr(220,440);
147 my= MouseY.kr(0.0,1.0);
149 Pan2.ar(Gendy1.ar(2,3,1,1,minfreq:mx, maxfreq:8*mx, ampscale:my, durscale:my, initCPs:7, mul:0.3), 0.0)
154 //1 CP = random noise effect
155 {Pan2.ar(Gendy1.ar(initCPs:1))}.play
157 //2 CPs = suudenly an oscillator (though a fast modulating one here)
158 {Pan2.ar(Gendy1.ar(initCPs:2))}.play
167 SinOsc.kr(0.1,0,0.49,0.51),
168 SinOsc.kr(0.13,0,0.49,0.51),
170 SinOsc.kr(0.17,0,0.49,0.51),
171 SinOsc.kr(0.19,0,0.49,0.51),
179 {Pan2.ar(Gendy1.ar(0, 0, SinOsc.kr(0.1, 0, 0.1, 0.9),1.0, 50,1000, 1,0.005, 12, 12, 0.2), 0.0)}.play
182 //modulate distributions
183 //change of pitch as distributions change the duration structure and spectrum
184 {Pan2.ar(Gendy1.ar(MouseX.kr(0,7),MouseY.kr(0,7),mul:0.2), 0.0)}.play
187 //modulate num of CPs
188 {Pan2.ar(Gendy1.ar(knum:MouseX.kr(1,13),mul:0.2), 0.0)}.play
191 (//Gendy into Gendy...with cartoon side effects
193 maxfreq:Gendy1.kr(5,4,0.3, 0.7, 0.1, MouseY.kr(0.1,10), 1.0, 1.0, 5,5, 500, 600),
194 knum:MouseX.kr(1,13),mul:0.2), 0.0)
198 //use SINUS to track any oscillator and take CP positions from it, use adparam and ddparam as the inputs to sample
199 {Pan2.ar(Gendy1.ar(6,6,LFPulse.kr(100, 0, 0.4, 1.0), SinOsc.kr(30, 0, 0.5),mul:0.2), 0.0)}.play
202 //try out near the corners especially
204 {Pan2.ar(Gendy1.ar(6,6,LFPulse.kr(MouseX.kr(0,200), 0, 0.4, 1.0),
205 SinOsc.kr(MouseY.kr(0,200), 0, 0.5),mul:0.2), 0.0)}.play
214 freq= rrand(130,160.3);
215 Pan2.ar(SinOsc.ar(Gendy1.ar(6.rand,6.rand,SinOsc.kr(0.1,0,0.49,0.51),
216 SinOsc.kr(0.13,0,0.49,0.51),freq ,freq, SinOsc.kr(0.17,0,0.49,0.51),
217 SinOsc.kr(0.19,0,0.49,0.51), 12, 12, 200, 400), 0, 0.1), 1.0.rand2)
222 //wahhhhhhhh- try durscale 10.0 and 0.0 too
227 Gendy1.ar(2,3,minfreq:1, maxfreq:MouseX.kr(10,700), durscale:0.1, initCPs:10),
228 MouseY.kr(50,1000), 0.1)
243 freq= rrand(130,160.3);
245 Pan2.ar(Gendy1.ar(6.rand,6.rand,1.0.rand,1.0.rand,freq ,freq, 1.0.rand, 1.0.rand, numcps,
246 SinOsc.kr(exprand(0.02,0.2), 0, numcps/2, numcps/2), 0.5/(n.sqrt)), 1.0.rand2)
251 //another traffic moment
261 freq= rrand(50,560.3);
263 Pan2.ar(Gendy1.ar(6.rand,6.rand,1.0.rand,1.0.rand,freq ,freq, 1.0.rand, 1.0.rand, numcps,
264 SinOsc.kr(exprand(0.02,0.2), 0, numcps/2, numcps/2), 0.5/(n.sqrt)), 1.0.rand2)
266 ,MouseX.kr(100,2000), MouseY.kr(0.01,1.0))
281 freq= rrand(330,460.3);
283 Pan2.ar(Gendy1.ar(6.rand,6.rand,1.0.rand,1.0.rand,freq,MouseX.kr(freq,2*freq), 1.0.rand, 1.0.rand, numcps,
284 SinOsc.kr(exprand(0.02,0.2), 0, numcps/2, numcps/2), 0.5/(n.sqrt)), 1.0.rand2)
286 ,MouseX.kr(100,2000), MouseY.kr(0.01,1.0))