/usr/share/SuperCollider/HelpSource/Classes/Pevent.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 | class:: Pevent
summary:: Provide an inval for an event stream.
related:: Classes/Pkey, Classes/Pchain
categories:: Streams-Patterns-Events>Patterns
This pattern is mainly used in two cases:
definitionlist::
## using an event pattern as a stream directly
||
code::
a = Pbind(\note, Prand([1, 2, 3], inf)).asStream;
a.next; // returns nil
a = Pevent(Pbind(\note, Prand([1, 2, 3], inf))).asStream;
a.next; // returns an event
::
## setting some default values before they are processed by the pattern
||
code::
Pevent(Pbind(\harmonic, Pseq([24, 25, 29, 30], inf)), (octave: 3, dur: 0.2)).trace.play;
::
::
Pevent is a simpler form of link::Classes/Pchain::, so that these are equivalent:
code::
Pevent(pattern, event)
Pchain(pattern, event)
pattern <> event
::
By contrast to Pchain, Pevent uses an link::Classes/Event#*default:: if nothing is provided.
ClassMethods::
method:: new
argument::pattern
pattern or stream that returns or modifies events.
argument:: event
an event with objects to embed. If none is provided, it uses link::Classes/Event#*default::.
examples::
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 = Pn(
Plazy({
Pbind(
\instrument, \help_sinegrain,
\freq, Pgeom(rrand(200, 600), rrand(1.001, 1.01), rrand(10, 100)).wrap(100, 15000),
\dur, Pgeom(rrand(0.2, 0.3), rrand(0.99, 0.92))
)
})
);
Tdef(\x, {
var str = Pevent(a).asStream, event;
loop {
event = str.next;
if(event[\freq] % 50 < 20) { event[\freq] = event[\freq] * [1, 1.2, 1.5] };
event.play;
event[\dur].wait;
}
}).play;
)
::
|