This file is indexed.

/usr/share/SuperCollider/HelpSource/Classes/Pwalk.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
class:: Pwalk
summary:: A one-dimensional random walk over a list of values that are embedded
related:: Classes/Pbrown
categories:: Streams-Patterns-Events>Patterns>List

ClassMethods::

method::new

argument::list
The items to be walked over.

argument::stepPattern
Returns integers that will be used to increment the index into list.

argument::directionPattern
Used to determine the behavior at boundaries. When the index crosses a boundary, the next direction is drawn from this stream: 1 means use stepPattern as is, -1 means go in the reverse direction. Common patterns:
definitionList::
## 1 || always wrap around to the other boundary.
## Pseq([1, -1], inf) || go forward first, then backward, then forward again.
::

argument::startPos
Where to start in the list.

Examples::

code::
(
a = Pwalk(
	Array.series(20, 0, 1),		// integers, 0-19
		// steps up to 2 in either direction, weighted toward positive
	Pwrand([-2, -1, 0, 1, 2], [0.05, 0.1, 0.15, 1, 0.1].normalizeSum, inf),
		// reverse direction at boundaries
	Pseq([1, -1], inf),
	10);	// start in the middle
x = a.asStream;
)

200.do({ x.next.post; ", ".post });

b = a.copy.directionPattern_(1);	// this one will always wrap around
x = b.asStream;

200.do({ x.next.post; ", ".post });



// non-random walk: easy way to do up-and-down arpeggiation
s.boot;
(
a = Pwalk(
	[60, 64, 67, 72, 76, 79, 84].midicps,	// C major
	Pseq([1], inf),
	Pseq([1, -1], inf),	// turn around at either end
	0);
x = a.asStream;

SynthDef(\help_walk, { arg freq;
	Out.ar(0, Saw.ar([freq, freq+1], 0.5) * EnvGen.kr(Env.perc(0.01, 0.1), doneAction:2))
}).add;
)

(
r = Task({
	{
		Synth.new(\help_walk, [\freq, x.next]);
		0.1.wait;
	}.loop;
}).play(SystemClock);
)

r.stop;
::