NaderLabs

Cycletron

Public Alpha · AGPL-3.0

Live coding for music, built on Rust. Cycletron is a native desktop instrument: write Strudel-style patterns in a CodeMirror editor and press Cmd+Enter. Edits take effect on the next evaluation; there is no compile step. The engine is strudel-rs, my Rust reimplementation of the Strudel pattern language, compiled to WASM and running in an AudioWorklet. An AI operator is available, opt-in and off by default.

engine:strudel-rs → WASMcode:29k Rust + 20k TStests:249visualizers:12
Cycletron main window: pattern code in the editor, an active orbital visualizer, and the sequence grid showing per-voice lanes

Audio architecture

Live audio runs entirely in Rust compiled to WASM, inside an AudioWorklet fed through SharedArrayBuffer. The Tauri backend stays out of the live signal path: it handles AI, the corpus, files, and offline export rendering. WebKit does not expose SharedArrayBuffer over the tauri:// scheme, so release builds embed the frontend with rust-embed and serve it from http://127.0.0.1 with COOP/COEP headers.

An example from the built-in showcase corpus: four-on-the-floor drums with an acid bassline.

// Four-on-the-floor + acid bass · 130 BPM
setbpm(130);

stack(
  s("bd*4").gain(0.9),
  s("~ cp ~ cp").gain(0.6),
  s("[hh hh hh oh]*4").gain(0.35),
  note("c2 c2 c3 c2 eb2 c2 g2 c2")
    .s("sawtooth")
    .cutoff(400)
    .resonance(15)
    .gain(0.5),
  note("c1*4")
    .s("sine")
    .gain(0.4)
)

The AI operator

The AI operator is opt-in, off by default, and works with Claude, Grok, OpenAI, Codex, or any OpenAI-compatible endpoint, including local models via Ollama or LM Studio. API keys are stored in the OS keychain.

The model has 32 tools: corpus search, pattern generation, validation, critique, arrangement analysis, and transport control. It cannot send samples or control the audio graph. To play something, it writes code into the editor and evaluates it, using the same path as a user, so everything it plays remains visible, editable source. A telemetry loop records per-tool failure rates and retry loops, which guides changes to the tool surface.

Pattern generators

The algorithmic composition layer is pure Rust functions over integer and boolean series. The same implementation backs the offline CLI tools and the AI's in-app generation, and each generator's output is checked before it is used:

Algorithms

Per Nørgård's infinity series for fractal self-similar melody, elementary cellular automata for evolving rhythm, hexbeat strings for onset grids, Roman-numeral progressions, and palindromic form mirroring.

Grid alignment

Drum lanes are boolean masks of identical width, enforced by the type system, so an 8-step kick cannot drift against a 9-step clap.

Round-trip verification

Every generator's output is parsed back through the strudel-rs evaluator and its onsets compared to the intent. If emit and parse-of-emit disagree, the generator is wrong.

Deterministic repair

A repair pass fixes only mechanical errors with exactly one unambiguous rewrite, and only touches constructs that are already invalid. kick → bd is a rename; chirp → hh would change the sound, so it's excluded.

Spectral masking analysis

Loudness checks catch clipping but not masking. Cycletron estimates per-voice energy across six perceptual bands from data the engine already emits (sound, note, filter settings), without rendering audio.

Song compression

Arrangements are run-length compressed at the section level, and bar sequences are factored inside each section: intro A A B A A B collapses to <i a!2 b a!2 b> over four unique bodies.

Pattern corpus

Cycletron ships with a built-in library of example patterns covering rhythm, melody, harmony, form, timbre, and motion, plus genre recipes that pin down how each genre actually moves: BPM range, swing, typical drum and bass parts. None of it is decorative. Every curated example passes a corpus checker that runs the same validation pipeline the AI uses and confirms the pattern produces events; a pattern that emits nothing fails the check. The engine's dialect differs from web Strudel in places, so a dialect document catalogs the known differences, and the editor's autocompletions are generated from the engine's actual DSL surface at every build.

MIDI and export

The MIDI Lab imports .mid files and converts them to patterns with a conservative cleanup pass (ghost notes, overlap duplicates, velocity clamping) without modifying the source file. You can also play patterns in live from a controller, map CCs, and trigger learnable pads. Songs export to WAV, MP3, per-track stems, or MIDI. There are also twelve music-reactive fullscreen visualizer modes, including Lissajous curves, strange attractors, and matrix rain.

Downloads

Builds for all three platforms: a signed and notarized universal macOS .dmg, Linux AppImage/deb/rpm (an AUR PKGBUILD ships in-repo), and a Windows NSIS installer. Cycletron is in public alpha with frequent releases; current builds are on the latest GitHub release.

Note: Cycletron speaks Strudel-compatible mini-notation but is built on strudel-rs, an independent Rust engine. It is not affiliated with the Strudel project.