Skip to content

controlkit: an envelope view and a routing diagram - #191

Merged
bdbarnett merged 1 commit into
mainfrom
controlkit-envelope-routing
Nov 20, 2026
Merged

bdbarnett merged 1 commit into
mainfrom
controlkit-envelope-routing

Conversation

@bdbarnett

Copy link
Copy Markdown
Contributor

controlkit gets two display controls. EnvelopeView draws a rate and level envelope of any number of stages as a curve: a higher rate draws a shorter segment, an optional sustain stage holds as a dashed line, set_selected() lights the stage being edited and set_position() moves a playhead. RoutingDiagram draws a small modulation graph given as nodes, edges, carriers and one feedback pair: modulators stack over what they modulate, carriers sit on the bottom row and join one output line, and the feedback loop has its own colour. A node can be selected, lit in any colour, and tapped. Neither control knows about any particular synth.

Both draw their lines with lv.line, which keeps a pointer to its points and never copies them, so each control keeps the point buffers, and a delete callback keeps the control alive for as long as its LVGL object lives. mock.py gains a few envelopes and graphs to show and a MockEnvelope that moves a playhead. The 32 classic six-operator FM algorithms are in examples/routing_algorithms.py as plain edge lists, used by the routing example and by the tests; the control itself has no table.

I ran test_controls.py on CPython 3.12 and unix MicroPython: the contract passes, and its planted run fails the rate, row and placement checks as it should. It lays out all 32 algorithms at 240 x 160 and 480 x 320 and checks that every box is inside the diagram, shows its number and touches no other. Removing the delete callback made the "a view the host doesn't keep still draws" checks fail on CPython; MicroPython's collector didn't free the buffers in that run, so there the check passes either way. I rendered both controls off screen in the black and silver themes and read the images (two are in the README), ran both examples in an SDL window on each interpreter, and ran tools/check_stubs.py on the changed modules.

Nothing ran on a board. The algorithm table was written from memory of the published charts and checked for structure only (carrier counts, every operator used, all 32 different), not against an engine.

EnvelopeView draws a rate and level envelope of any number of stages as a
curve, lights the stage being edited and shows a moving playhead.
RoutingDiagram draws a small modulation graph from data: modulators stacked
over their targets, carriers along the bottom joined to one output, and a
feedback loop. Neither knows what kind of synth it is drawing for.

The contract builds both on CPython and unix MicroPython, lays out the 32
six-operator FM algorithms at 240 x 160 and 480 x 320 with no box touching
another, and its planted run fails the rate and row checks.
@bdbarnett
bdbarnett force-pushed the controlkit-envelope-routing branch from e0a1ab7 to ff5b829 Compare November 20, 2026 10:52
@bdbarnett
bdbarnett merged commit 037301d into main Nov 20, 2026
15 checks passed
@bdbarnett
bdbarnett deleted the controlkit-envelope-routing branch November 20, 2026 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant