Skip to content

textmode.synth.js ​

Create shader-backed, live-coded textmode scenes by composing generators and transforms into a SynthSource chain.

Sketch workflow ​

  1. Add SynthPlugin to the sketch's plugins.
  2. Start a chain with a source generator such as noise or osc.
  3. Shape it with coordinate, color, combination, and modulation transforms.
  4. Route the result to character, foreground-color, and cell-color channels with char, charColor, cellColor, and paint.
  5. Apply the completed chain with t.synth(source).

Use src for feedback, layer, image, or video sampling. Parameters accept values, callbacks that receive SynthContext, or modulated arrays for time-based motion.

Origins ​

textmode.synth.js adapts the compositional approach of hydra-synth by Olivia Jack for the textmode.js ecosystem.

Example ​

Extensibility ​

Register custom transform and source definitions with setFunction.

NameDescription
ExtensionOptionsOptions controlling a single or batch registration.
ExtensionRegistrationHandle returned by a successful registration.
TransformDefinitionDefinition of a synthesis transform function.
TransformInputInput parameter definition for a transform function.
SourceFunctionA standalone function that starts a source chain.
SynthTransformTypeTransform type categories determining how functions compose in the shader pipeline.
setFunctionRegister one or more transform definitions using Hydra's setFunction() contract.

Live-Coding Errors ​

Hooks for reporting invalid or failed dynamic parameter evaluation without stopping rendering.

NameDescription
DynamicErrorCallbackCallback signature for dynamic parameter evaluation errors. Live coding environments can use this to display errors without interrupting rendering.
setGlobalErrorCallbackSet a global error callback for dynamic parameter evaluation errors.

Output Channels ​

Functions that route synthesized values to characters, foreground colors, and cell colors.

FunctionDescription
cellColorCreate a synth source with cell background color defined.
charCreate a character source from any color/pattern source.
charColorCreate a synth source with character foreground color defined.
paintCreate a synth source with both character and cell colors defined.

Parameter Modulation ​

Values, callbacks, context, easing, and arrays for time-varying synth parameters.

NameDescription
ModulatedArrayExtended array interface with modulation methods.
SynthContextContext passed to dynamic parameter functions during rendering.
EasingFunctionEasing functions from https://gist.github.com/gre/1650294
SynthParameterValueDynamic parameter value types supported by the synth system.
EASING_FUNCTIONSEasing functions from https://gist.github.com/gre/1650294

Sources & Sampling ​

Functions that start a chain from procedural patterns, feedback, layers, or media.

FunctionDescription
gradientGenerate a rotating radial gradient.
moireGenerate moire interference patterns.
noiseGenerate Perlin noise patterns.
oscGenerate oscillating patterns using sine waves.
plasmaGenerate plasma-like sine field patterns.
shapeGenerate geometric shapes (polygons).
solidGenerate a solid grayscale color.
srcSample a source for synth compositions.
voronoiGenerate voronoi patterns.

Synthesis Chains ​

The chainable source object that records transforms for shader compilation.

ClassDescription
SynthSourceA chainable synthesis source that accumulates transforms to be compiled into a shader.

Workflow ​

The plugin that enables synthesis on textmode.js layers.

VariableDescription
SynthPlugintextmode.synth.js plugin for textmode.js.