2 summary:: timed embedding of values
4 categories:: Streams-Patterns-Events>Patterns>Time
8 Pstep is good for representing chord progressions, scale progressions, accent patterns, etc.
13 Levelpattern can return individual values, arrays, or events. The value returned by levelpattern is returned for the duration returned by durpattern.
19 // select a chord and duration and repeat it for a random time interval
22 \ctranspose, [0, 4, 7],
24 \dur, Prand([0.2, 0.4, 0.8], inf)
26 Prand([1, 2, 4], inf)/4
30 // change degree independant of number of events that have been playing
36 \degree, Pbrown(0, 12, 1),
37 \dur, Pstep( Pseq([0.1, 0.2, 0.4, 0.8, 1.6], inf), 3.2)
40 \degree, Pbrown(0, 20, 1),
41 \dur, Pstep( Pseq([0.1, 0.2, 0.4, 0.8, 1.6], inf), 4.5)
45 \scale, Pstep(Pseq([ [0, 2, 4, 5, 7, 9, 11], [0, 1, 2, 3, 4, 5, 6]], inf), 5),
46 \db, Pstep(Pseq([2, -2, 0, -2], inf), 0.25) - 10
51 // use a simple pattern
56 \octave, [5, 6] + Prand([0, 0, \r], inf),
57 \degree, Proutine({ | ev | loop { ev = Pseq(ev[\degree]).embedInStream } }),
58 \dur, Proutine({ loop { Pseq([0.2, 0.2, 0.2, 0.2, 0.3].scramble).embedInStream } })
63 \dur, Proutine({ loop { Pseq([0.2, 0.2, 0.2, 0.2, 0.3].scramble * 5).embedInStream }})
67 \db, Pseq([0, -4, -2, -4, -3, -4, -3, -4], inf) - 20
71 \degree, Pfunc({ {10.rand}.dup(10) }),
72 \scale, Pfunc({ {rrand(1, 2)}.dup(7).integrate })
81 // change one parameter
84 \degree, Pstep(Pseq([1, 2, 3, 4, 5]), 1.0).trace,
85 \dur, Pseries(0.1, 0.1, 15)
90 // change degree independant of number of events that have been playing
95 \degree, Pstep(Pseq([0, 2b, 3], 1), 1.0),
96 \dur, Prand([0.2, 0.5, 1.1, 0.25, 0.15], inf)
99 \degree, Pseq([0, 2b, 3], 1),
103 Pseq([Event.silent(1.25), Ppar([a, b])], inf).play;
108 // test tempo changes
113 \degree, Pstep(Pseq([0, 2b, 3], 1), 1.0),
114 \dur, Prand([0.2, 0.5, 1.1, 0.25, 0.15], 9)
117 \degree, Pseq([0, 2b, 3], 1),
122 Ppar([a, b], inf).play;
126 SystemClock.sched(0, { TempoClock.default.tempo = [1, 2, 3, 5].choose.postln; 2 });
128 TempoClock.default.tempo = 1.0;
141 { arg out = 0, freq=800, sustain=0.001, amp=0.5, pan = 0;
143 window = Env.sine(sustain, amp);
146 SinOsc.ar(freq) * EnvGen.ar(window, doneAction:2),
153 times = Pseq([3.4, 1, 0.2, 0.2, 0.2], inf);
154 levels = Pseq([0, 1, 2, 3, 4], inf);
156 a = Pstep(levels, times);
157 b = Pbind(\instrument, \pgrain, \octave, 7, \dur, 0.12, \degree, a);
160 Ppar([b, Pset(\mtranspose, 2, b) ]).play;
164 var z = x.asStream; // direct times
169 Synth(\pgrain, [\freq, 3000, \sustain, 0.01]); // signal tone