textmode.synth.js
Create shader-backed, live-coded textmode scenes by composing generators and transforms into a SynthSource chain.
Sketch workflow
- Add SynthPlugin to the sketch's plugins.
- Start a chain with a source generator such as noise or osc.
- Shape it with coordinate, color, combination, and modulation transforms.
- Route the result to character, foreground-color, and cell-color channels with char, charColor, cellColor, and paint.
- 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.
| Name | Description |
|---|---|
| ExtensionOptions | Options controlling a single or batch registration. |
| ExtensionRegistration | Handle returned by a successful registration. |
| TransformDefinition | Definition of a synthesis transform function. |
| TransformInput | Input parameter definition for a transform function. |
| SourceFunction | A standalone function that starts a source chain. |
| SynthTransformType | Transform type categories determining how functions compose in the shader pipeline. |
| setFunction | Register 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.
| Name | Description |
|---|---|
| DynamicErrorCallback | Callback signature for dynamic parameter evaluation errors. Live coding environments can use this to display errors without interrupting rendering. |
| setGlobalErrorCallback | Set a global error callback for dynamic parameter evaluation errors. |
Output Channels
Functions that route synthesized values to characters, foreground colors, and cell colors.
| Function | Description |
|---|---|
| cellColor | Create a synth source with cell background color defined. |
| char | Create a character source from any color/pattern source. |
| charColor | Create a synth source with character foreground color defined. |
| paint | Create a synth source with both character and cell colors defined. |
Parameter Modulation
Values, callbacks, context, easing, and arrays for time-varying synth parameters.
| Name | Description |
|---|---|
| ModulatedArray | Extended array interface with modulation methods. |
| SynthContext | Context passed to dynamic parameter functions during rendering. |
| EasingFunction | Easing functions from https://gist.github.com/gre/1650294 |
| SynthParameterValue | Dynamic parameter value types supported by the synth system. |
| EASING_FUNCTIONS | Easing functions from https://gist.github.com/gre/1650294 |
Sources & Sampling
Functions that start a chain from procedural patterns, feedback, layers, or media.
| Function | Description |
|---|---|
| gradient | Generate a rotating radial gradient. |
| moire | Generate moire interference patterns. |
| noise | Generate Perlin noise patterns. |
| osc | Generate oscillating patterns using sine waves. |
| plasma | Generate plasma-like sine field patterns. |
| shape | Generate geometric shapes (polygons). |
| solid | Generate a solid grayscale color. |
| src | Sample a source for synth compositions. |
| voronoi | Generate voronoi patterns. |
Synthesis Chains
The chainable source object that records transforms for shader compilation.
| Class | Description |
|---|---|
| SynthSource | A chainable synthesis source that accumulates transforms to be compiled into a shader. |
Workflow
The plugin that enables synthesis on textmode.js layers.
| Variable | Description |
|---|---|
| SynthPlugin | textmode.synth.js plugin for textmode.js. |