A symbol, like a String, is a sequence of characters. Unlike strings, two symbols with exactly the same characters will be the exact same object. Symbols are optimized for recreating the same symbol over and over again. In practice, this means that symbols are best used for identifiers or tags that are only meaningful within your program, whereas you should use a string when your characters are really processed as text data. Use symbols to name things, use strings for input and output.
Good uses of symbols include symbolic constant values and Dictionary keys.
Symbols are represented syntactically as literals which are described in Literals: Symbols.
A symbol can be written by surrounding characters by single quotes (may include whitespace):
'foo bar'
Or by a preceding backslash (then it may not include whitespace):
\foo
A String can be converted into a symbol:
"arbeit".scramble.asSymbol;
Answer whether the symbol can be a class name. This does not say if the class exists.
Answer whether the symbol can be meta class name. This does not say if the class exists.
Answer whether the symbol has a trailing underscore.
Answer whether the symbol is a valid primitive name
Return true if the symbol is a valid variable name, or equivalently a valid method name in the two most common method call syntaxes (foo.bar()
and bar(foo)
). A valid identifier contains only alphanumeric characters and underscores, and the first character must be a lowercase letter.
Return true if the symbol is a valid binary operator. A valid binary operator contains only the symbols !@%&*-+=|<>?/
, does not start with '//
' or '/*
', and is not the string '=
'.
Convert to a String
Convert to an Integer
Answer the Class named by the receiver.
Return a symbol with a trailing underscore added.
Return a symbol with a trailing underscore removed.
return the ascii codes as an array
Convert to a ControlSpec
Convert to a Tuning
Convert to a Scale
Symbols are used as keys to look up objects in dictionaries and environments, but also in arrays. See IdentityDictionary, Environment, Event
put a value to the current environment using receiver as key
return a value from the current environment using receiver as key
Symbols respond to all unary and binary math operations by returning themselves. The result of any math operation between a Number or other math object and a Symbol is to return the Symbol. This allows for example operations on lists of notes which contain 'rest's to preserve the rests.
Pseq([1, 3, \rest, 2, 4] + 8);
Use the symbol as a method selector and perform the message on firstArg, with args as arguments. This is used for mixing functions with method selectors (see also: Function).
Inside SynthDefs and UGen functions, symbols can be used to conveniently specify control inputs of different rates and with lags (see: NamedControl, ControlName, and Control).
Return a control rate NamedControl input with a default value (val), and if supplied, with a lag. If val is an array, the control will be multichannel. A ControlSpec provided to the spec
parameter will be written into the spec metadata for the current synth.
Return an audio rate NamedControl input with a default value (val), and if supplied, with a lag. If val is an array, the control will be multichannel.
Return an initialization rate NamedControl input with a default value (val). If val is an array, the control will be multichannel.
Return a TrigControl input with a default value (val). If val is an array, the control will be multichannel.
See VarGui shortcut builds. Instantiate a VarGui object for control of one or more Synth(s) derived from a SynthDef name which may also be given as String. Per default controlspecs are taken from metadata definition, if defined with the SynthDef, or the global dictionary Spec.specs. Controls can be excluded with exclude, added with ctrBefore or ctrAfter and replaced with ctrReplace, this is also the order of operations.
ctrBefore |
a spec pair collection of the form [ key, spec, ... ] where key is the symbol of the control arg to be set and spec can be a collection of the form [ minval, maxval, warp, step, default ] defining the corresponding ControlSpec, a Symbol / String to look for a ControlSpec in the global dictionary Spec.specs or a collection of specs of this form for an arrayed control. May also be a SimpleNumber for a dummy slider with fixed value. Defaults to nil. Also takes a Function of indices that returns a valid arg. |
ctrReplace |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
ctrAfter |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
exclude |
a collection of control keys (Symbols) to be excluded. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
metaKey |
Symbol. Key to lookup SynthDef metadata. Also takes a Function of indices that returns a Symbol. Defaults to \specs. |
useGlobalSpecs |
Boolean. Defines if to consider global ControlSpecs if metadata is not given. Also takes a Function of indices that returns a Boolean. Defaults to true. |
num |
Boolean. Integer. Number of Synths to be controlled. Defaults to 1. |
server |
Server. Defaults to the default server. |
See VarGui shortcut builds. Instantiate a VarGui object for control of one or more Pbind(s) / EventStreamPlayer(s), derived from a SynthDef name which may also be given as String. One or more Pbind(s) with Pfunc pairs and the corresponding environmental variable controls are generated, controls for duration and legato are added. Per default controlspecs are taken from metadata definition, if defined with the SynthDef, or the global dictionary Spec.specs. Controls can be excluded with exclude, added with ctrBefore or ctrAfter and replaced with ctrReplace; Pbind pairs can be excluded with exclude, added with pBefore or pAfter: and replaced with pReplace, this is the order of operations for Synths and Pbind pairs. Note that exclude applies to Synth controls and Pbind pairs. If an added Pbind pair with key \degree, \note or \midinote is detected, \freq is excluded automatically from Pbind and controls. Gate control is excluded per default.
ctrBefore |
a spec pair collection of the form [ key, spec, ... ] where key is the symbol of the environmental variable to be set and spec can be a collection of the form [ minval, maxval, warp, step, default ] defining the corresponding ControlSpec, a Symbol / String to look for a ControlSpec in the global dictionary Spec.specs or a collection of specs of this form for an arrayed control if the environmental variable should have the value of a collection itself. May also be a SimpleNumber for a dummy slider with fixed value. Defaults to nil. Also takes a Function of indices that returns a valid arg. |
ctrReplace |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
ctrAfter |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
durCtr |
a controlspec of the form [ minval, maxval, warp, step, default ] or a Symbol / String to look for a ControlSpec in the global dictionary Spec.specs. Also takes a Function of indices that returns a valid arg. Defaults to #[0.05, 3, \exp, 0, 0.2]. |
legatoCtr |
a controlspec of the form [ minval, maxval, warp, step, default ] or a Symbol / String to look for a ControlSpec in the global dictionary Spec.specs. Also takes a Function of indices that returns a valid arg. Defaults to #[0.1, 5, \exp, 0, 0.8]. |
pBefore |
a Pbind pair collection of the form [ key, patterns, ... ]. Also takes a Function of indices that returns a Pbind pair collection. Defaults to nil. |
pReplace |
a Pbind pair collection of the form [ key, patterns, ... ]. Also takes a Function of indices that returns a Pbind pair collection. Defaults to nil. |
pAfter |
a Pbind pair collection of the form [ key, patterns, ... ]. Also takes a Function of indices that returns a Pbind pair collection. Defaults to nil. |
exclude |
a control key (Symbol) or a collection of control keys to be excluded from Pbind pairs and controls. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
excludeGate |
Boolean. Determines if gate control should be excluded. Also takes a Function of indices that returns a Boolean. Defaults to true. |
clock |
TempoClock, nil or collection thereof for playing streams. Also takes a Function of indices that returns a valid arg. Defaults to the default TempoClock. |
quant |
Quant, Float, nil or collection thereof used as quant data for playing streams. Also takes a Function of indices that returns a valid arg. Defaults to Quant.default (none). |
metaKey |
Symbol. Key to lookup SynthDef metadata. Also takes a Function of indices that returns a Symbol. Defaults to \specs. |
useGlobalSpecs |
Boolean. Defines if to consider global ControlSpecs if metadata is not given. Also takes a Function of indices that returns a Boolean. Defaults to true. |
post |
Boolean. Determines if to post order of Pbind pairs. Also takes a Function of indices that returns a Boolean. Defaults to false. |
trace |
Boolean. Determines if EventStreamPlayer should post Events when playing. Also takes a Function of indices that returns a Boolean. Defaults to false. |
num |
Integer. Number of Pbinds / EventStreamPlayers to be controlled. Defaults to 1. |
See VarGui shortcut builds. Generate control data for one or more Synth(s) derived from a SynthDef name which may also be given as String. Returns a grouped collection, also for num = 1. Data can directly been used as input to VarGui's synthCtr arg. This method can be used for control of Synths derived from more than one SynthDef in one VarGui or combined control of Synths and Pbinds / EventStreamPlayers.
ctrBefore |
a spec pair collection of the form [ key, spec, ... ] where key is the symbol of the control arg to be set and spec can be a collection of the form [ minval, maxval, warp, step, default ] defining the corresponding ControlSpec, a Symbol / String to look for a ControlSpec in the global dictionary Spec.specs or a collection of specs of this form for an arrayed control. May also be a SimpleNumber for a dummy slider with fixed value. Defaults to nil. Also takes a Function of indices that returns a valid arg. |
ctrReplace |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
ctrAfter |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
exclude |
a collection of control keys (Symbols) to be excluded. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
metaKey |
Symbol. Key to lookup SynthDef metadata. Also takes a Function of indices that returns a Symbol. Defaults to \specs. |
useGlobalSpecs |
Boolean. Defines if to consider global ControlSpecs if metadata is not given. Also takes a Function of indices that returns a Boolean. Defaults to true. |
num |
Boolean. Integer. Number of Synths to be controlled. Defaults to 1. |
See VarGui shortcut builds. Generate envir variable control data for one or more Environments derived from a SynthDef name which may also be given as String. Returns a grouped collection, also for num = 1. Data can directly been used as input to VarGui's varCtr arg. This method can be used for control of Pbinds / EventStreamPlayers derived from more than one SynthDef in one VarGui or combined control of Synths and Pbinds / EventStreamPlayers.
ctrBefore |
a spec pair collection of the form [ key, spec, ... ] where key is the symbol of the environmental variable to be set and spec can be a collection of the form [ minval, maxval, warp, step, default ] defining the corresponding ControlSpec, a Symbol / String to look for a ControlSpec in the global dictionary Spec.specs or a collection of specs of this form for an arrayed control if the environmental variable should have the value of a collection itself. May also be a SimpleNumber for a dummy slider with fixed value. Defaults to nil. Also takes a Function of indices that returns a valid arg. |
ctrReplace |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
ctrAfter |
a spec pair collection of a form like ctrBefore. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
durCtr |
a controlspec of the form [ minval, maxval, warp, step, default ] or a Symbol to look for a ControlSpec in the global dictionary Spec.specs. Also takes a Function of indices that returns a valid arg. Defaults to #[0.05, 3, \exp, 0, 0.2]. |
legatoCtr |
a controlspec of the form [ minval, maxval, warp, step, default ] or a Symbol to look for a ControlSpec in the global dictionary Spec.specs. Also takes a Function of indices that returns a valid arg. Defaults to #[0.1, 5, \exp, 0, 0.8]. |
exclude |
a control key (Symbol) or a collection of control keys to be excluded from Pbind pairs and controls. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
excludeGate |
Boolean. Determines if gate control should be excluded. Also takes a Function of indices that returns a Boolean. Defaults to true. |
metaKey |
Symbol. Key to lookup SynthDef metadata. Also takes a Function of indices that returns a Symbol. Defaults to \specs. |
useGlobalSpecs |
Boolean. Defines if to consider global ControlSpecs if metadata is not given. Also takes a Function of indices that returns a Boolean. Defaults to true. |
num |
Integer. Number of Pbinds / EventStreamPlayers to be controlled. Defaults to 1. |
See VarGui shortcut builds. Generate Pbinds with Pfunc pairs derived from corresponding SynthDef metadata resp. global ControlSpecs. Duration and legato pairs are added by default. If an added Pbind pair with key \degree, \note or \midinote is detected, \freq is excluded automatically. Returns a collection, also for num = 1.
pBefore |
a Pbind pair collection of the form [ key, patterns, ... ]. Also takes a Function of indices that returns a Pbind pair collection. Defaults to nil. |
pReplace |
a Pbind pair collection of the form [ key, patterns, ... ]. Also takes a Function of indices that returns a Pbind pair collection. Defaults to nil. |
pAfter |
a Pbind pair collection of the form [ key, patterns, ... ]. Also takes a Function of indices that returns a Pbind pair collection. Defaults to nil. |
exclude |
a control key (Symbol) or a collection of control keys to be excluded from Pbind pairs and controls. Also takes a Function of indices that returns a valid arg. Defaults to nil. |
excludeGate |
Boolean. Determines if gate control should be excluded. Also takes a Function of indices that returns a Boolean. Defaults to true. |
excludeDur |
Boolean. Determines if \dur should be excluded from the Pbind. Also takes a Function of indices that returns a Boolean. Defaults to false. |
excludeLegato |
Boolean. Determines if \legato should be excluded from the Pbind. Also takes a Function of indices that returns a Boolean. Defaults to false. |
metaKey |
Symbol. Key to lookup SynthDef metadata. Also takes a Function of indices that returns a Symbol. Defaults to \specs. |
useGlobalSpecs |
Boolean. Defines if to consider global ControlSpecs if metadata is not given. Also takes a Function of indices that returns a Boolean. Defaults to true. |
post |
Boolean. Determines if to post order of Pbind pairs. Also takes a Function of indices that returns a Boolean. Defaults to false. |
trace |
Boolean. Determines if EventStreamPlayer should post Events when playing. Also takes a Function of indices that returns a Boolean. Defaults to false. |
num |
Integer. Number of Pbinds / EventStreamPlayers to be controlled. Defaults to 1. |
Returns a Note whose MIDI pitch matches the given note name