An AlgaNode is the fundamental element of Alga. Conceptually, it is very similar to a single module of a modular synthesizer, which, however, can be dynamically created, replaced and patched on the fly.
There are 4 important features that make AlgaNodes different from other forms of patching already present in SuperCollider.
By going through the help files and the Examples folder, hopefully all these notions will be clearer.
Create a new AlgaNode.
def |
Mandatory argument. It accepts either a UGen function or a symbol to lookup a defined AlgaSynthDef. |
args |
Define default arguments for the parameters of the function or AlgaSynthDef. These can be Numbers, Arrays, AlgaNodes, AlgaTemps or AlgaArgs. |
interpTime |
Specify the interpolation time it takes whenever making a new connection to any parameter of this AlgaNode. |
interpShape |
Specify the interpolation shape that is to be used to perform new connections. This must be defined with an Env that always starts at 0 and ends at 1. If not specified, a single ramp |
playTime |
Specify the fading in / fading out time that it takes for this AlgaNode to play through speakers. These values are applied when calling the play or stop functions. |
playSafety |
Specify a different safety method to use to scale the output of a node when using the play method. Accepted values are: |
sched |
Just like any other AlgaNode method, the current function can be scheduled at specific times in the future, according to the clock that the Alga instance booted on the server is using. |
schedInSeconds |
Specify if all sched actions should be scheduled in seconds, opposing to beats. Default is |
tempoScaling |
Specify if all timed actions should be scaled by the clock's tempo. Default is |
outsMapping |
It works just like AlgaSynthDef's outsMapping argument, but for the case of using an UGen function as the obj argument. Specify new mappings by an array that maps symbols to specific output channels. If not specified, the default |
server |
Specify a Server to instantiated the AlgaNode on. This Server must have had Alga booted on it. It defaults to |
Play the AlgaNode to SuperCollider's output. Note that this method also ensures that no dangerous audio signals are forwarded to your speaker's output, with an implementation inspired by the SafetyNet quark ( https://github.com/adcxyz/SafetyNet ).
chans |
Specify an Array of output channels to play, which can contain outsMapping symbols. It's also possible to just specify a number, in which case it determines how many channels will be played. |
time |
Define a temporary connection time that the method takes to complete, applying the necessary interpolations. If not specified, playTime will be used. |
scale |
Specify a Number to scale the output by. |
out |
Specify a Bus index to play the node to. |
sched |
Just like any other AlgaNode method, the current function can be scheduled at specific times in the future, according to the clock that the Alga instance booted on the server is using. |
Stop the output to speakers.
Clear the AlgaNode, dropping all connections in place (with appropriate interpolation) as well as the output to speakers.
Replace the current content of the AlgaNode. This method also takes care of restoring all running connections, applying the correct connection times and rate / channels conversions.
def |
Mandatory argument. It accepts either a UGen function or a symbol to lookup a defined AlgaSynthDef. |
args |
Define default arguments for the parameters of the function or AlgaSynthDef. Note that these will be applied in regards to interpTime. |
time |
Define a temporary connection time that the method takes to complete, applying the necessary interpolations. |
sched |
Just like any other AlgaNode method, the current function can be scheduled at specific times in the future, according to the clock that the Alga instance booted on the server is using. |
outsMapping |
It works just like AlgaSynthDef's outsMapping argument, but for the case of using an UGen function as the obj argument. Specify new mappings by an array that maps symbols to specific output channels. |
reset |
Specify whether the parameters should keep their old connections or they should be reset to the default values. This argument either takes a boolean value (true / false) or an Array specifying the individual names of the parameters to reset, via Symbols (e.g. |
keepOutsMappingIn |
Specify whether the current output channels mapping of the AlgaNodes connected to the inputs of this one should be maintained. |
keepOutsMappingOut |
Specify whether the current output channels mapping of the AlgaNodes connected to the outputs of this one should be maintained. |
keepScalesIn |
Specify whether the scales of all the AlgaNodes connected to the inputs of this one should be maintained. |
keepScalesOut |
Specify whether the scales of all the AlgaNodes connected to the outputs of this one should be maintained. |
Connect the specific input parameter of this AlgaNode to the output of an AlgaNode, Number, Array, AlgaTemp or AlgaArg.
sender | |
param |
Which parameter to connect to. |
chans |
An optional Symbol or Array to specify which of the output channels mapping to take from the output of the sender. If not specified, all channels will be used. |
scale |
An optional Number or Array. If it is a number, the value works as a multiplier of the output of the sender. If it is an array, it can be specified in two different ways:
Note that all the values can be specified as arrays, in which case they map for specific channels. For example, |
time |
Define a temporary connection time that the method takes to complete, applying the necessary interpolations. |
shape |
Define a temporary shape to be used in the interpolation process. This must be defined with an Env starting at 0 and ending at 1. |
forceReplace |
Force a |
sched |
Just like any other AlgaNode method, the current function can be scheduled at specific times in the future, according to the clock that the Alga instance booted on the server is using. |
Shortcut for from, where, due to syntax restrictions, only sender and param can be specified. Connect the specific input parameter of this AlgaNode to the output of an AlgaNode, Number, Array, AlgaTemp or AlgaArg.
sender | |
param |
Which parameter to connect to. |
Same as from, where the receiver argument is the AlgaNode that the connection is applied to.
Shortcut for to, where, due to syntax restrictions, only receiver and param can be specified.
Same as from, but all active connections to the parameter are maintained. Essentially, this adds another connection to the specific parameter, adding the values of all the connections together.
Shortcut for mixFrom, where, due to syntax restrictions, only sender and param can be specified.
Same as mixFrom, where the receiver argument is the AlgaNode that the connection is applied to.
Shortcut for mixTo, where, due to syntax restrictions, only receiver and param can be specified.
Replace a connection in the mix of a specific parameter: newSender replaces oldSender. All the other arguments work the same as the other connection methods.
If oldSender is specified, disconnect that specific entry in the mix of a specific parameter. Otherwise, reset the entire parameter to its default value.
Same as disconnect where no oldSender is specified: reset the parameter to its default value, disconnecting all mix entries.
Shortcut for reset.
Execute a Function on the scheduler of this node.
condition |
A Function that must return |
func |
The Function to execute. |
sched |
When should the function be executed. In the case of AlgaPatterns, this can also be an AlgaStep. |
topPriority |
Specify if the function should be put at the top of the prioroty queue. |
preCheck |
Specify if the function should be executed right away in the case of a |
Specify a new time that the connections to any of the parameters will use to perform interpolations.
Shortcut for interpTime.
Specify a new time that the connections to the specific param will use to perform interpolations.
Shortcut for paramInterpTime.
Specify a new interpolation shape that the connections to any of the parameters will use to perform interpolations. This must be defined with an Env that always starts at 0 and ends at 1. If not specified, a single ramp Env([0, 1], 1)
is used by default.
Specify a new interpolation shape that the connections to the specific param will use to perform interpolations.
Shortcut for paramInterpShape.
Specify fade in / fade out times when calling play and stop.
Shortcut for playTime.
Specify a boolean to determine whether to use playTime
as the time parameter when calling replace on a node that was playing.
Shortcut for replacePlayTime.
Specify a different safety method to use to scale the output of a node when using the play method. Accepted values are: 'clip', 'tanh', 'softclip', 'limiter', 'none'
.
Specify a sched value to use for new actions. This will be used if sched is not provided in the arguments of the called function.
Specify if all sched actions should be scheduled in seconds, opposing to beats. Default is false
.
Specify if all timed actions should be scaled by the clock's tempo. Default is false
.