Repository navigation
Conversation
…docs/42) The design: the MRT2 pack and its importer, mrt_render on upstream's magentart::core with MLX from the mlx-metal wheel, the menu item and dialog, timing through the tempo map, where the render lands, why a child process, what comes later and the open questions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cs/42 §The pack) The importer downloads mrt2_small and its resources from Hugging Face at a pinned revision, checked by SHA-256 (--from copies an existing Magenta RT 2 folder), then builds mrt_render against magentart::core with MLX pinned at 0.31.2 from the wheel, so no Metal toolchain. It checks a one-second render before moving models/ into place. mrt_render plays a MIDI file's notes, one 40 ms frame at a time, in the style of a text prompt; the same notes, prompt and seed give the same WAV. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The clip menu's new item opens a dialog for a prompt and seed. The clip's notes go to MIDI through the tempo map, mrt_render runs as a child process with its progress in the dialog and CANCEL, and the WAV lands on a new track under the clip at the clip's start, in one undo step. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rom slabkit) The same timing as Render with MRT2, the WAV on a new track under the clip's. Renders are cached by notes, prompt, seed and length in <home>/Cache/mrt2/, so a song script re-runs without rendering again. smf.py gains a one-track writer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…g (docs/42 §The renderer) Upstream's worker sets the encoder's success before the quantizer starts, so "neither busy" could come before the style tokens existed and a render would ignore its prompt. Wait for both to report success, fail on an error or after two minutes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The engine keeps one state per pitch, so the first of two overlapping notes of a pitch released both. Count the notes held per pitch and only pass on the last release; a re-strike while held is still a new onset. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…slabkit) Every call wrote the same slabkit.mid, so two scripts rendering at once could hand each other's notes to the renderer and cache the wrong audio. The MIDI and partial WAV are now named by the render's inputs and the process, and removed afterwards; smf.encode returns the bytes to hash. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clip uids restart in each slab process, so two windows rendering at once shared <home>/Cache/mrt2/<uid>.mid and render.log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… §The pack manifest) The download entry pointed at a Hugging Face page, not a file. List the twelve files at the pinned revision with the SHA-256 the importer checks, and describe the pack by what it does; there is no Generate submenu. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Magenta RealTime 2 is Google DeepMind's open-weights live music model for Apple Silicon. It plays whatever MIDI notes are held in each 40 ms frame, in the style of a text prompt. That maps onto Slab's pattern clips: the clip's notes go in, and a performance in a described style comes out ("solo grand piano, warm", "west coast hip hop, deep bass"). I'm opening this as a draft so we can agree on the direction first. The design is in
docs/42-mrt2.md, which ends with three open questions.What it adds
Clip.mrt2(prompt, seed)in slabkit, so song scripts can do the same. It uses the same timing as the menu item and caches renders by their inputs, so re-running a script doesn't render again.packs/mrt2.pack.json,tools/mrt2/mrt2.py). Its importer downloads themrt2_smallweights and resources from Hugging Face at a pinned revision, checks each file's SHA-256, then buildsmrt_renderagainst upstream's C++ engine (magentart::core). MLX comes prebuilt from themlx-metalwheel, pinned to 0.31.2 because 0.32 can't load the published exports (RuntimeError: [import_function] Invalid string size when loading mrt2_small.mlxfn magenta/magenta-realtime#103). On a base M2 the first build took about 16 minutes and put 2 GB in<home>/Cache, mostly TFLite.mrt_render(tools/mrt2/native/): about 240 lines of C++ that turn a MIDI file, a prompt, and a seed into a WAV.Slab runs
mrt_renderas a child process, the same way pack importers run. That keeps MLX, TFLite, and SentencePiece out ofbuild.zig, so people who never install the pack build exactly what they build today. A model failure also can't take down the audio thread. Linking the engine in, which live playing would need, is in docs/42 under Later.Licensing
The weights are CC-BY-4.0 and are downloaded, not shipped; the pack's
README.txtcarries the attribution.magentart::coreis Apache-2.0 and is built on the user's machine. Google claims no rights in the output.Verification
zig build test: 506 passed and 2 skipped, plus the 2 bench tests. One skip is a new opt-in end-to-end test (SLAB_MRT2_TEST=1) that runs Slab's render job through an installed pack: clip to MIDI tomrt_renderto WAV, with the log followed. It passes when enabled. The other is an existing test that depends on what's installed locally.mrt2manifest parses and has an importer.mrt_renderbuilt, its one-second check render passing, andmodels/installed last.demos/synthpop_8barand got the new track under the clip; the pack card shows as installed.Notes
mrt2_smallrenders at roughly real time on a base M2 (measured 2026-10-17). MLX wheels start at macOS 14, so MRT2 needs macOS 14 or later while Slab supports 13.b.args, sobuild.zigandfy/build.zigno longer configure with it. I built with Zig 0.16.🤖 Generated with Claude Code