Pproto uses the makeFunction to allocate resources (buffers, buses, groups) and create a protoEvent that makes those resources available to a pattern. It is fully compatible with non-realtime synthesis using render.
The makeFunction "makes" the protoEvent (i.e. protoEvent is currentEnvironment
). Typically, it defines and yields a sequence of events that create the needed resources using the following Event types:
\bufNum
is used rather than \bufnum
which has a default value assigned.When Pproto ends, these eventTypes will respond to the cleanup call by deallocating any resources they have allocated. Do not assume your buffers, buses etc. will exist after Pproto stops!
The function yields each event. That event is then performed with possible modifications by enclosing patterns and the player (either an EventStreamPlayer or a ScoreStreamPlayer). The resultant event is returned to the function where it can be assigned to a key within the protoEvent.
The patternarray is played using Pfpar, a variant of Ppar that ends when any of its subpatterns end. In this way, you can use Pproto to create effects that can be controlled by a pattern that runs in parallel with the note generating pattern and ends together with that note generating pattern (see example 0 below).
A cleanupFunction that deallocates resources when the pattern ends or is stopped is automatically created. It can be replaced with a user defined cleanup if needed. This function receives two arguments: proto, the prototype event, and flag, which is set false if all nodes have been freed already by CmdPeriod.
Pbind(\freq, 700, \amp, 0.1)
and Pbind(*[freq: 700, amp: 0.1])