Plug
must be used in a Syn argument list. It represents a signal that will be initiated synchronously with the Syn's primary nodes, and connected to a Syn or Plug using a server bus.
A Plug's signal comes either from a SynthDef (identified by name) or a Function. The Plug also defines an argument list. This may itself contain Plugs, forming a tree structure.
Syn is designed for polyphony. Accordingly, everywhere that a Plug appears in an argument list will produce its own unique signal. This is done by copying the Plug at the moment of rendering it into the server messages. This means you cannot manipulate a Plug object by reference to the original. You will need to access the actual, performing Plug using Syn: -argAt or Plug: -argAt. *shared will suppress the copy so that a single Plug can route its signal to multiple inputs.
See Syn for usage details.
A Function needs to be converted into a SynthDef before playing it. This is an asynchronous operation.
If the Syn is played with messaging latency (see ServerTiming.html), the Plug will prepare the SynthDef immediately, wait for completion (Server: -sync), and then adjust the messaging latency so that the audio begins on time. In this case, if latency is too short, or there are too many Functions to prepare, the final bundle may be late. For performance, it is recommended to use prepared SynthDefs whenever practical.
If it's played without latency, it will still server.sync
, and the audio will be produced as soon as possible after that. Timing accuracy will be lost (but not any worse than Function: -play).
April 2025: If several Plugs reuse the same function definition, they may be able to reuse the temporary SynthDef.
Caching depends on functions sharing the same (identical) FunctionDef and the same "context." In ex. A, the two Plugs are based on physically distinct functions; hence their definitions are not identical, and two SynthDefs are generated. In ex. B, the two Plugs use one function object and share one SynthDef. (Executing the same block of code twice produces all-new function definitions; cache cannot be used across multiple interpreter invocations.)
Open functions may cause the "context" to be different, also preventing cache use (ex. C). Instead, if a function passes a parameter into a Plug's argument list, then the Plug function can be closed and share context, hitting cache (ex. D). Ex. E and F show the same distinction in a Pattern context.
Using a named SynthDef guarantees reuse, of course.
Create a new Plug instance.
source |
A Symbol (SynthDef name) or Function, defining the signal's source. |
args |
A Synth-style argument list (which may itself contain Plugs). |
rate |
Optional. In general, you should not need to specify this; Plug will attempt to determine the rate from the Function or SynthDef. (This assumes that the SynthDef has been added by SynthDef: -add.) |
numChannels |
Optional. In general, you should not need to specify this; Plug will attempt to determine the number of channels from the Function or SynthDef. |
map |
Optional. See Syn.html: Three-point%20modulation for details. |
A new Plug instance.
Create a new Plug instance, which is marked to avoid copying itself.
source |
A Symbol (SynthDef name) or Function, defining the signal's source. |
args |
A Synth-style argument list (which may itself contain Plugs). |
rate |
Optional. In general, you should not need to specify this; Plug will attempt to determine the rate from the Function or SynthDef. (This assumes that the SynthDef has been added by SynthDef: -add.) |
numChannels |
Optional. In general, you should not need to specify this; Plug will attempt to determine the number of channels from the Function or SynthDef. |
map |
Optional. See Syn.html: Three-point%20modulation for details. |
A new Plug instance.
Get or set the current Plug source. The current Plug instance will remain in place. Its prior Synth node will be replaced by a new Synth in the same location in the node tree, with the same argument values.
src |
Currently supported sources are: a string or symbol naming a SynthDef, or a function that creates UGens. |
latency |
Server messaging latency. |
Note that in general, users should interact with the owner Syn object, and not call these methods directly.
Change the Plug's input values.
... args |
A Synth-style argument list. |
Produce an OSC message to set the input values.
... args |
A Synth-style argument list. |
An OSC message (array).
Change the Plug's input values.
... args |
A Synth-style argument list. |
Produce an OSC message to Node: -setn the input values.
... args |
A Synth-style argument list. |
An OSC message (array).
Destroy this Plug, and release resources.
latency |
Messaging latency in seconds. |
If the Plug is active, return the bus that has been allocated.
Returns the owner Syn's target group.
Returns the Synth node producing the Plug's signal.
If true, this Plug represents a concrete signal. If false, it only defines an expected behavior (and will be copied at render time).
Returns \audio
or \control
.
Returns the number of channels for this Plug.
Returns the server object where this Plug is running.
Returns the actual argument list being used. Plugs in the original argument list may have been copied. This array will contain the copies.
Array of symbols, listing the synth's control input names.
Get the dictionary mapping parent-level control names onto a different control name belonging to this Plug. See Syn.html: Three-point%20modulation for details.
Returns the top-level Syn object.
Access the object from the argument list corresponding to the named input.
key |
An input name belonging to the Plug synth. |
A value from the argument list.
An IdentitySet of Plugs feeding directly into this Plug.
antecedents
and descendents
can be used to iterate over the tree structure.
An IdentitySet of Plugs receiving this Plug's signal.
Points to the Plug object immediately preceding this one in the server's node tree.
Returns the Plug's bus mapping string(s).
Returns the Plug's bus mapping string(s).
Returns the Plug's synth node.
Make the concrete, performing instance (unique signal) -- basically "copy."
See Syn: examples.