2 summary:: Finite State Machine
3 related:: Classes/Pdfsm
4 categories:: Streams-Patterns-Events>Patterns>List>Indexing
8 Every state consists of an item and an array of integer indices of possible strong::next states::. The initial state is chosen at random from the array of strong::entry states::. That chosen state's item is returned, and the next state is chosen from its array of possible strong::next states::. When the end state is chosen, the stream ends.
16 ## [ entry states ], ||
17 ## item, [ next states ], ||
18 ## item, [ next states ], ||
20 ## end item (or nil), nil ||
25 next states: nil is terminal
29 SynthDef(\help_sinegrain,
30 { arg out=0, freq=440, sustain=0.05;
32 env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
33 Out.ar(out, SinOsc.ar(freq, 0, env))
44 Pseq([74, 75, 76, 77]), #[2, 3, 3],
49 Synth(\help_sinegrain, [\freq, a.next.midicps]);
57 #[5, 6, 7], // entry states
60 Pbind( \dur, Pseq([ 1/8, 3/8 ]), \midinote, Pseq([ 86, 75 ]) ),
61 //#[1], // as given in CMJ
62 // my de-boredom-ated version..
63 #[1, 1, 1, 1, 1, 1, 1, 8],
65 Pbind( \dur, 1/2, \midinote, Pseq([ 69 ]) ),
68 Pbind( \dur, 1/3, \midinote, Pseq([ 55, 60, 66 ]) ),
69 #[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],
71 Pbind( \dur, 1/4, \midinote, Pseq([ 81, 80, 77, 76 ]) ),
74 Pbind( \dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \midinote, Pseq([ \, 70, 70, 70, \ ]) ),
77 Pbind( \dur, 1/4, \midinote, Pseq([ 59, 61 ]) ),
78 #[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],
80 Pbind( \dur, 1/4, \midinote, Pseq([ 87, 88 ], 2) ),
81 #[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],
83 Pbind( \dur, 1, \midinote, Pseq([ 56 ]) ),