K

Show a live display

Drive a spectrum or scope, and let people draw curves.

To show something moving, your DSP sends a stream of numbers to a display each block, and a widget reads it.

Feed a display

// 1. declare a channel in describe (name, size, role)
m.channel("spectrum", 512, CHANNEL_SPECTRUM);

// 2. fill it each block in process
ctx.writeChannel(0, myData); // myData is a Float32Array

// 3. point a widget at it in ui.ts
Spectrum({ input: channel("spectrum") });

Updates at 60fps and costs almost nothing, so call it once per block. Wiring the widget: Design a custom look.

Let people draw a curve

Let someone draw a shape your device reads, like a custom EQ curve or a wavetable:

// declare in describe
m.curveParam("shape", "Shape", 256);

// read in process (x from 0 to 1)
const y = ctx.curve(0, x);

// show an editor in ui.ts
CurveEditor({ bind: curve("shape") });

The drawing saves with your project and undoes like anything else.