Repository navigation
controlkit: an envelope view and a routing diagram - #191
Merged
Merged
Conversation
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
force-pushed
the
controlkit-envelope-routing
branch
from
November 20, 2026 10:52
e0a1ab7 to
ff5b829
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
controlkit gets two display controls.
EnvelopeViewdraws 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 andset_position()moves a playhead.RoutingDiagramdraws 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.pygains a few envelopes and graphs to show and aMockEnvelopethat moves a playhead. The 32 classic six-operator FM algorithms are inexamples/routing_algorithms.pyas plain edge lists, used by the routing example and by the tests; the control itself has no table.I ran
test_controls.pyon 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 rantools/check_stubs.pyon 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.