Skip to main content

Node

Enum Node 

Source
#[non_exhaustive]
pub enum Node {
Show 39 variants Square { freq: Value, duty: Value, }, Triangle { freq: Value, }, Sawtooth { freq: Value, }, Sine { freq: Value, }, Noise { color: NoiseColor, }, Fm { freq: Value, ratio: f32, index: Value, }, Super { wave: SuperWave, freq: Value, voices: u32, detune_cents: f32, }, Wavetable { wave: WavetableKind, freq: Value, position: Value, }, Seq {
Show 15 fields bpm: f32, tempo_map: Vec<TempoPoint>, steps_per_beat: u32, wave: SeqWave, duty: Value, fm: FmKnobs, pluck: PluckKnobs, piano: PianoKnobs, kit: KitStyle, bass: BassKnobs, sf2: Sf2Knobs, swing: f32, humanize: f32, env: Adsr, notes: Vec<SeqNote>,
}, Impact { hardness: f32, velocity: f32, }, Dust { density: f32, decay: f32, }, Env { adsr: Adsr, }, Tracks { tracks: Vec<Track>, master: Vec<Node>, buses: Vec<Bus>, }, Mix { inputs: Vec<Node>, }, Mul { inputs: Vec<Node>, }, Chain { stages: Vec<Node>, }, Lowpass { cutoff: Value, q: f32, }, Highpass { cutoff: Value, q: f32, }, Bandpass { cutoff: Value, q: f32, }, Notch { cutoff: Value, q: f32, }, Peak { cutoff: Value, q: f32, gain_db: f32, }, Lowshelf { cutoff: Value, gain_db: f32, }, Highshelf { cutoff: Value, gain_db: f32, }, Gain { amount: Value, }, Bitcrush { bits: u8, }, Downsample { factor: u32, }, Delay { secs: f32, feedback: f32, }, Reverb { room: f32, mix: f32, }, Modal { modes: Vec<Mode>, mix: f32, }, Drive { amount: Value, shape: DriveShape, aa: Option<bool>, }, RingMod { freq: Value, }, Tremolo { rate: f32, depth: f32, }, Flanger { rate: f32, depth: f32, feedback: f32, mix: f32, }, Phaser { rate: f32, depth: f32, feedback: f32, mix: f32, }, Chorus { rate: f32, depth: f32, mix: f32, }, Duck { trigger: Box<Node>, amount: f32, attack: f32, release: f32, }, Compress { threshold: f32, ratio: f32, attack: f32, release: f32, makeup: f32, }, Convolve { decay: f32, size: f32, predelay: f32, damp: f32, mix: f32, }, Granular { grain_ms: f32, density: f32, pitch: f32, spread: f32, mix: f32, },
}
Expand description

A node in the synthesis graph. Every node evaluates to a mono signal.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Square

Square/pulse wave with variable duty cycle. duty may be a modulator (e.g. an lfo) for PWM — the classic moving chiptune lead.

Fields

§freq: Value

Frequency in Hz.

§duty: Value

Fraction of the period spent “high”, 0..1 (0.5 = symmetric square).

§

Triangle

Triangle wave.

Fields

§freq: Value

Frequency in Hz.

§

Sawtooth

Sawtooth wave.

Fields

§freq: Value

Frequency in Hz.

§

Sine

Sine wave.

Fields

§freq: Value

Frequency in Hz.

§

Noise

Noise source (percussion / explosion / texture). White by default; pink is warmer (−3 dB/oct, good for wind/rumble), brown darker still.

Fields

§color: NoiseColor

Spectral colour of the noise.

§

Fm

Two-operator FM: a carrier at freq is phase-modulated by an operator at freq * ratio with modulation index. Bells, e-piano, metallic basses. Slide index down for a struck/plucked attack.

Fields

§freq: Value

Carrier frequency in Hz.

§ratio: f32

Modulator frequency as a multiple of the carrier (e.g. 2.0, 3.5).

§index: Value

Modulation index (depth). Higher ⇒ brighter / more sidebands.

§

Super

Unison “super” oscillator: voices detuned copies of a band-limited saw/square, summed for a fat, wide lead or pad (the supersaw). Detune is spread symmetrically across detune_cents.

Fields

§wave: SuperWave

Oscillator shape for every voice.

§freq: Value

Centre frequency in Hz (modulatable).

§voices: u32

Number of detuned voices (1..=16).

§detune_cents: f32

Total detune spread in cents across all voices.

§

Wavetable

Morphing wavetable oscillator: position (0..1) sweeps across an ordered set of built-in, single-cycle tables (see WavetableKind), crossfading between adjacent sub-waves — the classic wavetable sweep. Modulate position (an lfo or env) for the signature moving timbre: a vocal morph on formant, a brightness swell on harmonics. Tables are generated deterministically at build time (additive, band-limited to 32 partials — darker sub-waves use fewer), so no table files are needed; very high pitches at bright positions can fold.

Fields

§wave: WavetableKind

Which table set to morph across.

§freq: Value

Frequency in Hz (modulatable).

§position: Value

Morph position across the sub-waves, 0..1 (modulatable).

§

Seq

A note sequencer: plays notes on a tempo grid, each with its own pitch, length, and a shared per-note ADSR. This is how you write real melodies, basslines, and drum patterns (rests = gaps between notes).

Fields

§bpm: f32

Tempo in beats per minute.

§tempo_map: Vec<TempoPoint>

Tempo changes on the beat grid at exact rational positions, applied segment-wise (ADR 0002): a note’s start and end convert to seconds through the segments in f64 and land on frames with halves rounded away from zero. Empty = the constant-tempo bpm behavior — the only behavior documents had before this field existed, so they render byte-identically. The first point must sit at beat 0. Not supported on the sampler wave (validation rejects it).

§steps_per_beat: u32

Grid resolution: steps per beat (4 = sixteenth notes).

§wave: SeqWave

Instrument used for every note.

§duty: Value

Duty cycle when wave is square (may be modulated for PWM).

§fm: FmKnobs

FM voice knobs (wave: "fm"), flattened onto the node.

§pluck: PluckKnobs

Plucked-string knobs (wave: "pluck"), flattened onto the node.

§piano: PianoKnobs

Piano tone knobs (wave: "piano", engine ≥ 3), flattened onto the node.

§kit: KitStyle

Drum-kit voicing when wave is kit. Omitted ⇒ classic (the original kit, byte-identical); acoustic/electronic/808 are alternate synthesized kits.

§bass: BassKnobs

Bass tone knobs (wave: "bass"), flattened onto the node.

§sf2: Sf2Knobs

SoundFont sampler settings (wave: "sampler"), flattened onto the node.

§swing: f32

Swing, 0..1: every off-beat grid step is delayed by this fraction of a step (0 = straight, ~0.55 = classic shuffle). Off-beats are odd steps, so set steps_per_beat to the swung subdivision.

§humanize: f32

Humanize, 0..1: deterministic per-note timing and velocity jitter (from the doc’s seed) so repeats stop sounding machine-perfect. 0.1–0.25 is a tasteful player; 1 is sloppy.

§env: Adsr

Per-note amplitude envelope.

§notes: Vec<SeqNote>

The notes to play.

§

Impact

Impact exciter: a short excitation burst that models the contact force of a strike — a single raised-cosine force pulse whose width is set by hardness (hard = brief, bright click; soft = wider, duller thud), scaled by velocity. On its own it is a faint tick; its job is to excite a resonant body — put it before a modal bank (or any resonant filter) in a chain: chain[ impact, modal ] is a struck object. The harder the strike, the more high modes it lights up.

Fields

§hardness: f32

Strike hardness, 0..1 (1 = hardest / brightest / shortest contact).

§velocity: f32

Strike velocity / level, 0..1.

§

Dust

Sparse stochastic impulses — a Poisson click train. density events per second fire at random times with random ± amplitude, each decaying over decay seconds (0 = bare single-sample impulses). The grain generator behind crackle textures: fire, rain, geiger ticks, sparks, debris. Feed it through a bandpass/highpass (for tone) or a modal (for pitched debris). Its randomness draws from the layer’s deterministic stream, so like noise it is edit-stable within its own mixer layer.

Fields

§density: f32

Mean events per second.

§decay: f32

Per-grain decay time in seconds (0 = single-sample impulses).

§

Env

ADSR amplitude envelope with an sfxr-style punch transient.

Fields

§adsr: Adsr

Envelope shape.

§

Tracks

The mixing console — only valid as the document root. Each track is a mono graph placed on the stereo stage with its own pan and gain (sampler tracks keep their native stereo); master is a processor chain applied to the stereo bus (compressor glue, reverb — the reverb runs with decorrelated left/right tails). This is how multi- instrument music gets a real stereo image instead of a mono sum.

Fields

§tracks: Vec<Track>

The mixer channels.

§master: Vec<Node>

Processors applied to the stereo master bus, in order.

§buses: Vec<Bus>

Mix buses: named submixes with their own insert chains, returned onto the master bus (see Bus). Empty ⇒ the flat mixer documents have always had, byte-identical.

§

Mix

Sum (layer) all inputs.

Fields

§inputs: Vec<Node>

Branches to add together.

§

Mul

Multiply all inputs (typically source × envelope).

Fields

§inputs: Vec<Node>

Branches to multiply together.

§

Chain

Serial pipe: stage 0 is a source, each later stage processes the prior output.

Fields

§stages: Vec<Node>

Ordered processing stages.

§

Lowpass

Resonant low-pass filter.

Fields

§cutoff: Value

Cutoff frequency in Hz.

§q: f32

Resonance / quality factor.

§

Highpass

Resonant high-pass filter.

Fields

§cutoff: Value

Cutoff frequency in Hz.

§q: f32

Resonance / quality factor.

§

Bandpass

Band-pass filter.

Fields

§cutoff: Value

Center frequency in Hz.

§q: f32

Resonance / quality factor.

§

Notch

Notch (band-reject) filter: removes a narrow band around cutoff (hum / resonance removal).

Fields

§cutoff: Value

Center frequency in Hz.

§q: f32

Quality factor (higher ⇒ narrower notch).

§

Peak

Peaking EQ: boost or cut a band around cutoff by gain_db (surgical tone shaping — act on the brightness/centroid the analyzer reports).

Fields

§cutoff: Value

Center frequency in Hz.

§q: f32

Quality factor (bandwidth).

§gain_db: f32

Gain in dB (positive boosts, negative cuts).

§

Lowshelf

Low shelf: boost/cut everything below cutoff by gain_db (add weight or thin out lows).

Fields

§cutoff: Value

Shelf corner frequency in Hz.

§gain_db: f32

Gain in dB.

§

Highshelf

High shelf: boost/cut everything above cutoff by gain_db (air / de-ess).

Fields

§cutoff: Value

Shelf corner frequency in Hz.

§gain_db: f32

Gain in dB.

§

Gain

Scale the signal by a (possibly modulated) factor.

Fields

§amount: Value

Multiplier.

§

Bitcrush

Quantize amplitude to bits of resolution for crunch.

Fields

§bits: u8

Bit depth, 1..16.

§

Downsample

Sample-rate reduction by an integer factor for lo-fi grit.

Fields

§factor: u32

Hold each sample for this many samples.

§

Delay

Feedback delay (echo / comb).

Fields

§secs: f32

Delay time in seconds.

§feedback: f32

Feedback amount, 0..1.

§

Reverb

Schroeder-style reverb.

Fields

§room: f32

Room size, 0..1 (larger ⇒ longer tail).

§mix: f32

Dry/wet mix, 0..1.

§

Modal

Modal resonator bank: a set of damped sinusoidal partials (modes) excited by the incoming signal — a struck/resonant object’s body. Bells, glass, metal bars, wood, ceramic, coins, and the resonant ping of UI/impact sounds, none of which the oscillators can voice cleanly. Each mode is one 2-pole resonator (a constant-peak-gain bandpass), so a bank is N parallel resonators — cheap, stable, deterministic. Use it as a chain stage after an excitation: chain[ impact, modal ]. The excitation’s brightness lights the modes; the modes’ frequencies and decays define the timbre. Author modes explicitly — the cookbook’s struck-bodies guidance (harmonic vs off-harmonic ratios, short vs long decays) is the map from material to mode list.

Fields

§modes: Vec<Mode>

The resonant partials (1..=64). Each is a damped sine.

§mix: f32

Wet/dry mix, 0..1 (1 = pure resonance; lower keeps some of the raw excitation transient for extra attack click).

§

Drive

Waveshaper for saturation / distortion. amount is pre-gain; shape chooses the curve (warm tanh, aggressive hard clip, or foldback).

Fields

§amount: Value

Drive amount (pre-gain into the shaper).

§shape: DriveShape

Distortion curve.

§aa: Option<bool>

Antiderivative anti-aliasing. The waveshaper’s harmonics fold back as inharmonic alias dirt at the base rate; ADAA suppresses that for a clean, hi-fi distortion. Honoured only when the document’s engine is ≥ 1 (so legacy documents stay bit-exact); within an engine-1 document it is on by default — set false to hear the raw aliasing curve. Omitted ⇒ follow the engine.

§

RingMod

Ring modulation: multiply the signal by a sine carrier at freq. Metallic, clangorous, robotic textures.

Fields

§freq: Value

Carrier frequency in Hz.

§

Tremolo

Tremolo: per-sample amplitude modulation — the gain swings between 1 - depth and 1 at rate Hz. Unlike a modulated gain (which does not stream), the gain is a closed-form function of the absolute sample index, so tremolo streams natively and byte-identically to the offline render.

Fields

§rate: f32

LFO rate in Hz.

§depth: f32

Modulation depth, 0..1 (0 = transparent passthrough, 1 = full cut).

§

Flanger

Flanger: a very short modulated delay with feedback — the classic jet sweep / metallic whoosh. Stronger and more resonant than chorus.

Fields

§rate: f32

LFO rate in Hz.

§depth: f32

Modulation depth, 0..1.

§feedback: f32

Feedback amount, 0..1 (more ⇒ more resonant).

§mix: f32

Dry/wet mix, 0..1.

§

Phaser

Phaser: swept all-pass notches — a hollow, swooshing movement for pads, lasers, and sci-fi textures.

Fields

§rate: f32

LFO sweep rate in Hz.

§depth: f32

Sweep depth, 0..1.

§feedback: f32

Feedback amount, 0..1.

§mix: f32

Dry/wet mix, 0..1.

§

Chorus

Chorus: a short modulated delay mixed with the dry signal for thickening and width.

Fields

§rate: f32

LFO rate in Hz.

§depth: f32

Modulation depth, 0..1.

§mix: f32

Dry/wet mix, 0..1.

§

Duck

Sidechain duck: gain-reduces the chained signal whenever trigger is loud — the pumping that glues a bass or pad to the kick. The trigger is rendered silently (it only steers the gain); chain the audible kick separately in the mix.

Fields

§trigger: Box<Node>

The signal whose loudness drives the ducking (e.g. the kick seq).

§amount: f32

Duck depth, 0..1 (1 = fully silent at the trigger’s peak).

§attack: f32

Gain-reduction attack in seconds.

§release: f32

Recovery time in seconds (the “pump” length).

§

Compress

Dynamic-range compressor: tames peaks above threshold (dBFS) by ratio, with attack/release ballistics, then applies makeup gain (dB). The glue behind loud, punchy game audio.

Fields

§threshold: f32

Threshold in dBFS (e.g. -18).

§ratio: f32

Compression ratio (e.g. 4 = 4:1).

§attack: f32

Attack time in seconds.

§release: f32

Release time in seconds.

§makeup: f32

Make-up gain in dB.

§

Convolve

Convolution reverb with a synthesized impulse response — the “put it in a real space” effect, with zero assets: instead of loading an IR file, the node generates its own IR deterministically from its parameters and its structural position in the graph (the same node at the same graph position always builds the same IR — edit-stable like the structurally-seeded RNG sources of engine 2 and later). The IR is a white-noise burst under an exponential decay envelope reaching −60 dB at decay seconds (RT60-style), capped at size seconds, darkened over time by a one-pole lowpass whose cutoff falls per damp, and shifted right by predelay (the gap between the dry hit and the room’s answer — larger rooms answer later). Convolution is FFT-based (single-shot, the whole block at once) and normalized to unit IR energy, so the wet level stays put as decay / size change. Like reverb, the tail folds into the document: the output is truncated to the document length rather than extended. mix crossfades dry/wet (0 = transparent passthrough). This node is offline only: convolution needs the whole input buffer, so the streaming renderer refuses it with a named reason (bounce it offline and keep the streamed graph causal).

Fields

§decay: f32

RT60-ish decay time in seconds (tail reaches −60 dB at this point).

§size: f32

IR length cap in seconds (0 = decay, i.e. no extra truncation).

§predelay: f32

Silence before the IR starts, in seconds (pre-delay).

§damp: f32

High-frequency damping, 0..1: how fast the tail darkens (0 = the burst stays white, 1 = it closes to a rumble by the end).

§mix: f32

Dry/wet mix, 0..1.

§

Granular

Granular texture: chops the incoming signal into overlapping Hann-windowed grains of grain_ms milliseconds at density grains per second, replays each at pitch (playback ratio — 2 = octave up, 0.5 = octave down) with deterministic onset/source jitter and detune of depth spread (drawn from the node’s structurally-seeded stream in a fixed order, so the texture is stable under edits), sums them (normalized by the window overlap so loudness tracks the dry signal), and crossfades with the dry signal per mix. Frozen pads and shimmer from any source material: chain it after a note or a noise burst and let spread smear it into a cloud. mix 0 = transparent passthrough. Offline only — grains read the whole input out of order, so the streaming renderer refuses it with a named reason (bounce it offline and keep the streamed graph causal).

Fields

§grain_ms: f32

Grain length in milliseconds (5..=500).

§density: f32

Grains per second (overlap = grain_ms × density / 1000).

§pitch: f32

Grain playback ratio (1 = source pitch, 2 = octave up).

§spread: f32

Randomization depth, 0..1: onset jitter and per-grain detune.

§mix: f32

Dry/wet mix, 0..1.

Implementations§

Source§

impl Node

Source

pub fn is_processor(&self) -> bool

True if this node only makes sense as a non-first stage of a chain (it transforms an incoming signal rather than generating one).

Source

pub fn children(&self) -> Children<'_>

Every direct child of this node — the nested graphs of the combinator variants: mix/mul inputs, chain stages, a tracks’ layers then its master chain, and a duck’s trigger. The ONE traversal definition every walker shares, so a new variant can never be silently skipped the way the hand-written walkers were (the duck-trigger omissions in the vary and MIDI walkers were exactly that class). The match is exhaustive on purpose: adding a variant without a children decision is a compile error, never a silent skip.

Source

pub fn children_mut(&mut self) -> ChildrenMut<'_>

Mutable form of children.

Source

pub fn walk(&self, f: &mut impl FnMut(&Node))

Apply f to this node and every descendant, depth-first (parents before children, in document order).

Source

pub fn walk_mut(&mut self, f: &mut impl FnMut(&mut Node))

Mutable form of walk.

Trait Implementations§

Source§

impl Clone for Node

Source§

fn clone(&self) -> Node

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Node

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Node

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl JsonSchema for Node

Source§

fn schema_name() -> Cow<'static, str>

The name of the generated JSON Schema. Read more
Source§

fn schema_id() -> Cow<'static, str>

Returns a string that uniquely identifies the schema produced by this type. Read more
Source§

fn json_schema(generator: &mut SchemaGenerator) -> Schema

Generates a JSON Schema for this type. Read more
Source§

fn inline_schema() -> bool

Whether JSON Schemas generated for this type should be included directly in parent schemas, rather than being re-used where possible using the $ref keyword. Read more
Source§

impl Serialize for Node

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Node

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnsafeUnpin for Node

§

impl UnwindSafe for Node

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more