This file is indexed.

/usr/share/SuperCollider/HelpSource/Classes/Pfsm.schelp is in supercollider-common 1:3.8.0~repack-2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
class:: Pfsm
summary:: Finite State Machine
related:: Classes/Pdfsm
categories:: Streams-Patterns-Events>Patterns>List>Indexing

description::

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.

Examples::

definitionList::
## list:
|| [
definitionList::
## [ entry states ], ||
## item, [ next states ], ||
## item, [ next states ], ||
## ... ||
## end item (or nil), nil ||
::
## ] ||
::

next states: nil is terminal

code::
(
SynthDef(\help_sinegrain,
	{ arg out=0, freq=440, sustain=0.05;
		var env;
		env = EnvGen.kr(Env.perc(0.01, sustain, 0.2), doneAction:2);
		Out.ar(out, SinOsc.ar(freq, 0, env))
	}).add;
)


(
a = Pfsm([
		#[0,1],
		67, #[0, 0, 3],
		72, #[2],
		73, #[0, 2],
		Pseq([74, 75, 76, 77]), #[2, 3, 3],
		nil, nil
	], inf).asStream;
Routine({
	loop({
		Synth(\help_sinegrain, [\freq, a.next.midicps]);
		0.1.wait;
	})
}).play;
)

(
Pfsm([
	#[5, 6, 7], // entry states

	//e1 (== state 0)
	Pbind( \dur, Pseq([ 1/8, 3/8 ]), \midinote, Pseq([ 86, 75 ]) ),
	//#[1],	// as given in CMJ
	// my de-boredom-ated version..
	#[1, 1, 1, 1, 1, 1, 1, 8],
	//e2 (== state 1)
	Pbind( \dur, 1/2, \midinote, Pseq([ 69 ]) ),
	#[0, 1],
	//e3 (== state 2)
	Pbind( \dur, 1/3, \midinote, Pseq([ 55, 60, 66 ]) ),
	#[0, 1, 2, 2, 2, 2, 3, 3, 3, 3],
	//e4 (== state 3)
	Pbind( \dur, 1/4, \midinote, Pseq([ 81, 80, 77, 76 ]) ),
	#[1, 4, 4, 4, 4],
	//e5 (== state 4)
	Pbind( \dur, Pseq([1, 2/3, 2/3, 2/3, 1]), \midinote, Pseq([ \, 70, 70, 70, \ ]) ),
	#[2, 3],
	//e6 (== state 5)
	Pbind( \dur, 1/4, \midinote, Pseq([ 59, 61 ]) ),
	#[0, 2, 4, 5, 5, 5, 5, 5, 5, 5],
	//e7 (== state 6)
	Pbind( \dur, 1/4, \midinote, Pseq([ 87, 88 ], 2) ),
	#[4, 4, 4, 4, 6, 6, 6, 7, 7, 7],
	//e8 (== state 7)
	Pbind( \dur, 1, \midinote, Pseq([ 56 ]) ),
	#[1, 3, 6, 6, 6],
	// terminal state
	nil, nil
]).play;
)
::