2 summary:: Different ways that an Event can "play"
3 categories:: Streams-Patterns-Events>Events
4 related:: Classes/Event
6 Note:: this helpfile is incomplete. ::
8 An link::Classes/Event:: responds to a code::play:: message by evaluating ~play in the event, and the default behaviour of ~play is determined by the value of ~type. Commonly-used event types include:
11 ## \note || used to instantiate a synth on the server, with specified arguments, and later to free it. The choice of link::Classes/SynthDef:: is specified using the \instrument key. This event type is commonly implicit in much Pattern usage.
12 ## \set || used to set parameters of some already-running node(s). (See also: note in link::Classes/Pmono:: helpfile)
15 A more complete list of event types is given further down this document. To see how event types are normally invoked, here is a slightly simplified version of the default definition of ~play as defined in the Event class:
17 { ~eventTypes[~type].value(server); },
20 The function uses the value of ~type to select a function from the Dictionary held in ~eventTypes. The collection of eventTypes can be readily extended using link::Classes/Event#*addEventType#*addEventType::(key, function).
22 Here is an example the uses the event types \group and \note:
24 (type: \group, id: 2).play // create a group with nodeID 2
25 (type: \note, freq: 500, group: 2).play // play a synth in that group
28 Here is a listing of currently existing event types:
30 ## group || creates group, ~id must be specified
31 ## note || ~instrument specifies synthdef
35 ## monoNote || used by Pmono
36 ## monoSet || used by Pmono
39 ## on || play synth, ~id must be specified
40 ## off || release synth (or free if no gate)
42 ## set || set parameter of synth
46 ## bus || write ~array to control buses starting at ~out
48 ## alloc || allocate ~bufnum with ~numframes and ~numchannels
49 ## free || free ~bufnum
50 ## gen || send ~gencmd to ~bufnum
51 ## load || load ~filename starting at ~frame into ~bufnum
54 ## setProperties ~receiver, ~args || sends setter messages to ~receiver for each key in ~args that has a nonNil value in the Event.
56 ## tree || creates a tree of groups. ~tree can be an array of nodeIDs, and may contain associations to further nested arrays.
58 ## phrase || instead of playing a single synth from a SynthDef with ~instrument, it looks up a Pdef and plays a cluster of sounds.