2 summary:: pattern that returns combinatoric sums
3 related:: Classes/Pstep3add
4 categories:: Streams-Patterns-Events>Patterns>Time
8 Combines an arbitrary number of patterns by summing (depth first traversal). When a stream ends it is recreated from its pattern until the top stream ends.
13 // comparing PstepNadd and Pstep3add (test)
15 x = PstepNadd(Pseq([1, 2, 3]), Pseq([10, 20, 30, 40]), Pseq([100, 200, 300])).asStream;
16 y = Pstep3add(Pseq([1, 2, 3]), Pseq([10, 20, 30, 40]), Pseq([100, 200, 300])).asStream;
18 50.do({ [x.next, y.next].postln });
21 // pattern return stream until the longest stream ended
24 Plazy({ "pattern1.asStream".postln; Pseq([1, 2, 3], 2) }),
25 Plazy({ "pattern2.asStream".postln; Pshuf([10, 20, 30, 40]) }),
26 Plazy({ "pattern3.asStream".postln; Pseq([100, 200, 300]) }),
27 Plazy({ Pseries(1, 1, 4) * 0.01 })
29 150.do({ x.next.postln });
32 // if the last pattern loops it the combinatorics loop there:
33 x = PstepNadd(Pseq([1, 2, 3]), Pseq([10, 20, 30, 40]), Pseq([100, 200, 300], inf)).asStream;
34 50.do({ x.next.postln });
36 // if the first pattern loops, the whole iteration loops as if it was used in a Pn(.., inf):
37 x = PstepNadd(Pseq([1, 2, 3], inf), Pseq([10, 20, 30, 40]), Pseq([100, 200, 300])).asStream;
38 y = Pn(PstepNadd(Pseq([1, 2, 3]), Pseq([10, 20, 30, 40]), Pseq([100, 200, 300])), inf).asStream;
39 150.do({ [x.next, y.next].postln });
47 Pseq([0, -2, [1, 3], -5]),
48 Pshuf([1, 0, 3, 0], 2),
52 Pseq([1, 0, 0, 1], 2),
53 Pshuf([1, 1, 2, 1], 2)
55 \legato, Pn(Pshuf([0.2, 0.2, 0.2, 0.5, 0.5, 1.6, 1.4], 4), inf),
56 \scale, #[0, 1, 3, 4, 5, 7, 8]