Forgot a help fix: Drag a dock's title bar, not divider, to reposition
[supercollider.git] / HelpSource / Classes / Ptime.schelp
blob2152328334ef10e6fed3380882a85e5fc28f006a
1 class:: Ptime
2 summary:: returns time in beats from moment of embedding in stream
3 related:: Classes/Pkey
4 categories:: Streams-Patterns-Events>Patterns>Time
6 Examples::
8 code::
10 a = Ptime.new;
11 x = a.asStream;
14 x.next;
15 x.next;
16 x.next;
18 // post time in a playing event stream
20 Pbind(
21         \pfunc, Ptime.new.trace,
22         \dur, Pseries(0.5, 0.5, 5)
23 ).play;
27 // change degree independant of number of events that have been playing
30 var a, b;
31 a = Pbind(
32         \degree, Pswitch(#[0, 2b, 3], Ptime(8).round(2) / 2),
33         \dur, Prand(#[0.2, 0.5, 1.1, 0.25, 0.15], inf)
35 b = Pbind(
36         \degree, Pseq(#[0, 2b, 3], 1),
37         \dur, 2,
38         \ctranspose, -7
40 Pseq([Event.silent(1.25), Ppar([a, b])], inf).play;
44 // test tempo changes
47 var a, b;
48 a = Pbind(
49         \degree, Pswitch(#[0, 2b, 3], Ptime(8).round(2) / 2),
50         \dur, Prand(#[0.2, 0.5, 1.1, 0.25, 0.15], 9)
52 b = Pbind(
53         \degree, Pseq(#[0, 2b, 3], 1),
54         \dur, 2,
55         \ctranspose, -7
57 Pn(
58         Pfset({ ~tempo = #[1, 2, 4].choose.postln },
59                 Pseq([
60                         Event.silent(1.25),
61                         Ppar([a, b])
62                 ])
63         )
64 ).play