Enums¶
nanosynth.enums ¶
Enum types for nanosynth.
CalculationRate ¶
Bases: IntEnum
UGen computation rate.
Determines how often a UGen computes new output values:
SCALAR(0) -- computed once at synth creation (initial rate,.ir).CONTROL(1) -- computed once per control block, typically every 64 samples (control rate,.kr).AUDIO(2) -- computed every sample (audio rate,.ar).DEMAND(3) -- computed only when explicitly demanded by another UGen (demand rate,.dr), used withDemand,Duty, etc.
When combining UGens at different rates, the result runs at the highest rate among its inputs (e.g. audio-rate + control-rate = audio-rate).
from_expr
classmethod
¶
from_expr(expr: object) -> CalculationRate
Coerce an arbitrary value to a CalculationRate.
Accepts CalculationRate instances, ParameterRate, numeric types
(treated as SCALAR), rate-token strings ("ar", "kr",
"ir"), and sequences (returns the maximum rate).
ParameterRate ¶
Bases: IntEnum
SynthDef parameter rate.
Controls how a SynthDefBuilder parameter is exposed to the server:
SCALAR(0) -- set once at synth creation; usesControl.ir.TRIGGER(1) -- re-triggers when the value changes; usesTrigControl.AUDIO(2) -- audio-rate input; usesAudioControl.CONTROL(3) -- standard control-rate parameter; usesControl.kr(orLagControlwhen a lag is specified).
Distinct from CalculationRate: this enum governs which Control UGen
type is generated, not the per-sample computation rate.
from_expr
classmethod
¶
from_expr(expr: object) -> ParameterRate
Coerce a value to a ParameterRate.
Accepts ParameterRate instances, rate-token strings ("ar",
"kr", "ir"), or integers.
BinaryOperator ¶
Bases: IntEnum
SuperCollider binary operator special indices.
Each member maps to a BinaryOpUGen special_index value that selects
the operation performed on two input signals. The 43 operators cover
arithmetic, comparison, bitwise, power, trigonometric, ring modulation,
and clipping operations.
UnaryOperator ¶
Bases: IntEnum
SuperCollider unary operator special indices.
Each member maps to a UnaryOpUGen special_index value that selects
the operation performed on a single input signal. The 34 operators cover
math (floor, ceil, sqrt, exp, log, trig), pitch conversion (midicps,
cpsmidi, dbamp, ampdb), and waveshaping (distort, softclip, tanh).
AddAction ¶
Bases: IntEnum
Node placement action for synth and group creation.
Controls where a new node is placed relative to the target node in the server's node tree:
ADD_TO_HEAD(0) -- add to the head of the target group (default).ADD_TO_TAIL(1) -- add to the tail of the target group.ADD_BEFORE(2) -- add immediately before the target node.ADD_AFTER(3) -- add immediately after the target node.REPLACE(4) -- replace the target node.
DoneAction ¶
Bases: IntEnum
Action to take when a UGen finishes (e.g. when an envelope completes).
Passed to EnvGen, Line, XLine, Linen, and other UGens
with a done_action parameter. The most common values:
NOTHING(0) -- do nothing when done.PAUSE_SYNTH(1) -- pause the enclosing synth (can be resumed).FREE_SYNTH(2) -- free (delete) the enclosing synth. This is the most commonly used done action.FREE_SYNTH_AND_ENCLOSING_GROUP(14) -- free the synth and its enclosing group.
EnvelopeShape ¶
Bases: IntEnum
Interpolation curve shape for envelope segments.
Controls how the Envelope class interpolates between breakpoints:
STEP(0) -- jump immediately to the target value.LINEAR(1) -- straight-line interpolation (default).EXPONENTIAL(2) -- exponential curve (values must not cross zero).SINE(3) -- sinusoidal S-curve.WELCH(4) -- Welch window curve (sinusoidal half-arch).CUSTOM(5) -- curvature controlled by a numeric curve value (positive = slow start, negative = fast start).SQUARED(6) -- squared interpolation.CUBED(7) -- cubed interpolation.HOLD(8) -- hold the start value until the end of the segment.
When a numeric value is passed as a curve to Envelope, it is
automatically treated as CUSTOM with that curvature.
from_expr
classmethod
¶
from_expr(expr: object) -> EnvelopeShape
Coerce a value to an EnvelopeShape.
Accepts EnvelopeShape instances, shape name strings, integers, or None (defaults to LINEAR).