Magenta RealTime 2

A music model you can play with, not just prompt. It answers what you play in about 200 milliseconds, on a laptop. The first version took two seconds.

Try both partners on the pads. Then we build, piece by piece, everything that closes that gap.

You need what an audio waveform is and the idea of a network that predicts the next token. We build the rest from zero.

Play along

Sound starts on your first tap

Your notes appear in the top lane. Your partner's answers travel toward the now line in the lane below.

Chapter 0

The latency wall

Why two seconds turns a jam into a fax machine

Sit down at a piano with a friend. You play a chord; they answer with a bassline; you nudge the rhythm; they follow. It works because the gap between your move and their response is tiny, a few tens of milliseconds. You don't experience a conversation. You experience playing together.

Now give that friend a two-second delay. You hit a chord; two seconds of silence; then their reply, for the chord you've already moved on from. That is the first partner on the pads above. The magic is gone, not because the friend is unmusical, but because of latency: the delay between an input and the system's reaction to it.

This is the wall every "AI music generator" has hit. Most models are offline: you type a prompt, wait, and a finished clip drops out. Wonderful for producing a track; useless for playing one. The original Magenta RealTime (MRT, or v1) was a landmark because it generated music continuously and let you steer it as it played. But its reactions lagged by around two seconds. You could conduct it, the way you'd conduct an orchestra over a slow phone line. You could not jam with it.

Magenta RealTime 2 (MRT2) cuts the reaction time from roughly two seconds to about 200 milliseconds, a ~15× improvement, while running on a consumer laptop. Two hundred milliseconds is where steering stops feeling like remote control and starts feeling like play. That one number, and everything the architecture had to become to hit it, is what this lesson is about.

Let's measure the wall on the beat grid. At 120 beats per minute each beat is 500 ms apart. You strike on beat 1; the partner answers after whatever latency you dial in.

Where the answer lands

Drag the latency. The teal dot is you on beat 1, the warm dot is the reply. Press Hear it to play two bars with a click track.

2,000 ms
Why 200 ms is the magic number. Musicians playing together tolerate roughly 20 to 40 ms before timing falls apart. We can't put a neural net there yet. But ~200 ms is inside a single beat, so a player can anticipate it and pocket it, the way a drummer rides slightly behind the beat on purpose. Two seconds is four beats away. There is no anticipating that. The jump from 2000 to 200 isn't "a bit faster": it crosses the line from conducting to playing.

So the design goal of MRT2, in one sentence: generate high-fidelity stereo music continuously, let a musician change MIDI notes, audio style, and drums at any instant, and react within ~200 ms, all on an Apple-Silicon MacBook. Every architectural choice ahead is downstream of that sentence. Whenever something looks strange ("why not just use a normal Transformer?"), the answer will almost always be: because of the wall.

Here is the road, in order:

  1. Sound as tokens: turn audio into discrete symbols a language model can predict.
  2. Chunks vs frames: predict one 40 ms frame at a time instead of a two-second chunk. This is the central trick.
  3. Two transformers: make each frame cheap to predict.
  4. Streaming forever: attend to an unbounded past without running out of memory.
  5. Steering, notes, the vibe, the mixer: the controls, and how they share one fast clock.
  6. The budget: add up every millisecond of the 200.
What single capability separates MRT2 from a typical type-a-prompt-and-wait music generator?

Chapter 1

Sound as tokens

The neural audio codec, and why one instant of music is twelve tokens deep

A language model predicts the next token from a finite vocabulary. Raw audio isn't tokens. One second of CD-quality stereo is 96,000 floating-point numbers: 48,000 samples per second, two channels. You cannot ask a Transformer to predict the next floating-point sample 96,000 times a second; the sequence would be astronomically long and the values continuous. We need to turn the river of audio into a manageable stream of discrete symbols. The device that does this is a neural audio codec.

Think of it as a learned MP3. A classical codec compresses with hand-designed math. A neural codec learns the compression: an encoder network squashes a waveform into a short sequence of integer codes, and a decoder network expands those codes back into a waveform that sounds almost identical. The integers in the middle are exactly the tokens our language model will predict. MRT2's codec is called SpectroStream.

Every later chapter leans on the dimensions, so let's pin them down. Hover or tap any symbol to see what it means. The input waveform is:

a
The audio. Bold because it's a big array of numbers, not one value.
ℝ
The real numbers: each entry is a continuous amplitude, like 0.0123.
T
The clip's length in seconds.
fs
The sampling rate, amplitude samples stored per second. For SpectroStream, 48,000 (48 kHz).
× 2
The two stereo channels, left and right.

So a one-second clip is a 48,000 × 2 grid of real numbers. The encoder turns it into a much smaller grid of integers:

x
The token grid the language model actually sees.
Vc
The codec vocabulary, the integer codes a token may take: 210 = 1,024 per slot.
fk
The token frame rate: 25 frames per second, so one frame covers 40 ms. That number is the heartbeat of the whole model.
dc
The depth: how many tokens describe a single frame. SpectroStream uses 12.

One second, as the model sees it

Top: a stereo waveform cut into 25 frames of 40 ms. Bottom: the 300 integers the codec turns it into, one column per frame, coarse at the top. Tap a frame.

8

Why does one frame need twelve tokens instead of one? Because of how the codec quantizes, a scheme called residual vector quantization (RVQ). Suppose you must describe a precise colour using a fixed palette of 1,024 paint chips. Your first chip is the closest single match, but it's a bit off. So you look at the residual, the leftover difference, and pick a second chip that best captures that. Then the leftover of the leftover. Stack 12 chips and you've described the colour far more exactly than any single one could. RVQ does this with sound: token 1 is the coarse approximation of the 40 ms frame, token 2 corrects its error, and so on down to token 12, the finest detail. Coarse to fine, twelve levels deep.

You can hear that ladder. The device below quantizes a short chord one rung at a time.

Hear the ladder

The grey line is the original sound, zoomed to a few milliseconds. The blue line is what survives with the rungs you allow. Climb from 1 to 12 and listen to the error shrink.

3 of 12

Each rung here chooses between just two codes and works on raw samples, so you can hear every rung matter. SpectroStream's rungs each choose among 1,024 codes and quantize learned features of a 40 ms frame. Same coarse-to-fine logic, far more detail per rung.

Now the compression ratio. SpectroStream squeezes 48 kHz stereo to about 3 kbps. One second is 25 frames of 12 tokens: 300 tokens per second. Against 96,000 raw samples, the codec has shrunk what the language model must predict by 320×. That shrinkage is what makes real-time prediction thinkable.

1 second → 25 frames × 12 tokens = 300 tokens (vs 96,000 samples)

The round trip closes cleanly. At generation time the language model produces a fresh token grid x′, and the decoder turns it back into audio: a′ = Dec(x′). The language model never touches a waveform. It lives entirely on these integer grids, and the codec is the translator at both ends.

The data flow, end to end. Microphone or file → a (48k×2 reals per second) → Enc → x (25×12 codes per second). The language model predicts the next frame's 12 codes → x′ → Dec → a′ → speakers. Everything else in this lesson happens in the middle, on the integer grid.
SpectroStream encodes one second of 48 kHz stereo. How many tokens does the language model see per second, and why more than 25?

Chapter 2

Chunks vs frames

The unit of autoregression is the floor on reaction time

This is the idea that is MRT2. Everything else supports one decision: what size piece of audio does the model commit to at a time?

An autoregressive model generates a sequence by repeatedly predicting the next piece and feeding it back in. The crucial knob is how big that piece is: the unit of autoregression. And here is the iron law that ties it to the wall: the model cannot react to your input faster than the unit it's committed to generating. If it's midway through a piece, your change can only take effect at the start of the next one. The unit size is the minimum reaction delay.

The original Magenta RealTime chose a big unit: a 2-second chunk, generated by a T5-style encoder-decoder. The encoder reads its context with bidirectional attention, looking forward and backward across the window. That's powerful, but "looking forward" only makes sense when you hold a whole window, so the model works a chunk at a time. The consequence for latency is brutal: your control change can't land until the next 2-second boundary. Minimum reaction delay, about 2 seconds. The wall, baked into the architecture.

MRT2 shrinks the unit to a single frame: 12 tokens, 40 ms. Instead of committing to two seconds of the future, it commits to forty milliseconds, then reconsiders. To do that it drops the bidirectional encoder (there's nothing ahead to peek at inside a frame that doesn't exist yet) and becomes a decoder-only model with strictly causal attention: each token sees only the past. That's the trade. v1 bought richer context at the cost of a 2-second reaction; MRT2 buys 40 ms granularity at the cost of never peeking ahead. For a live instrument, that's the right trade.

Twist the knob

Stopped

Both models play the same groove. Press play, then twist the knob whenever you like: it asks for a brighter chord. v1 can only change at its next 2-second wall; MRT2 changes on its next 40 ms frame. Choose which one you hear.

Read the gap between the two reaction markers. MRT2's is never more than 40 ms after you act. v1's can be nearly two full seconds. That gap is the 15× improvement, made audible.

The reframing in one line. v1 asked: "what are the next two seconds of music?" MRT2 asks, 25 times a second: "what are the next 40 milliseconds, given everything so far and whatever you just did?" Same goal, far finer grain. The finer grain is the product.

Shrinking the unit creates two new problems, and much of the rest of the lesson solves them. First: a frame is still 12 tokens, and rolling those out naively 25 times a second could be too slow, so we need a cheap way to produce them (Chapter 3). Second: a causal decoder that runs forever accumulates an ever-growing history, and attention cost grows with it, so we need to attend to the past without paying for all of it (Chapter 4).

Why does MRT2's 40 ms frame give ~15× lower control latency than v1's 2-second chunk?

Chapter 3

Two transformers

One reads across time, one reads down the ladder

We just committed to generating one 40 ms frame at a time. But a frame is 12 RVQ tokens, and they aren't independent: token 5 only makes sense as a correction to tokens 1 to 4. Meanwhile frame i depends on the whole musical past. We have dependency in two directions: along time, frame to frame, and along depth, token to token within a frame.

The naive fix is to flatten everything into one sequence of 300 tokens per second and run one giant Transformer. It works, but it re-attends over the entire flattened history for every one of the 12 tokens in every frame. MRT2 splits the labour between two Transformers, a design from the RQ-Transformer family:

Temporal transformer (θ)

once per frame, 25 per second

Reads the history of past frames and compresses it into one context vector: "given everything so far, here's the situation now." The expensive, over-history part.

Depth transformer (φ)

12 per frame, 300 per second

Small and fast. Given that context vector plus the coarser tokens already chosen, it picks the next finer token. It walks down the ladder, never across time.

You pay for history once per frame, then cheaply expand it into 12 tokens. Here is the probability the two networks model together. It factorises along both axes, frames outside, depth inside:

Pθ,φ(x)
The probability of the whole token grid, under both networks' weights.
∏i
Multiply over every frame, 1 to seconds × 25. The time axis.
∏j
Inside each frame, multiply over every depth level, 1 (coarsest) to 12 (finest).
xij
The token being predicted: level j of frame i.
xi<j
The coarser tokens already chosen in this same frame. The depth network reading the ladder above it.
Temporalθ(x<i)
The context vector the temporal network made from all earlier frames. "The past," as one summary.
Pφ
The depth network's softmax over the 1,024 possible codes: SoftMax(Depthφ(·)).

So to generate frame i, the temporal network fires once; then the depth network fires 12 times, each time conditioned on that vector plus the tokens it has laid down this frame. Decode those 12 codes with SpectroStream and you have 40 ms of fresh stereo. Repeat 25 times for a second.

Roll out one frame

Step through it. The temporal network fires once and hands over a context vector; the depth network then fills the 12 rungs, each one reading the rungs above. Or generate a full second and watch the counters.

Worked count. For one second of music the temporal network fires 25 times; the depth network fires 25 × 12 = 300 times. Played as clicks, 25 per second is a rattle and 300 per second is a pitch, a low hum: that's the button above. The depth network is small and never attends across history, so its 300 firings are cheap. Rare but heavy temporal, frequent but light depth: that asymmetry makes 25 frames a second feasible on a laptop.
In MRT2's two-Transformer design, how often does the expensive "attend over all past frames" computation run, per frame generated?

Chapter 4

Streaming forever

Sliding windows, and the tokens that hold the softmax up

MRT2 is meant to play indefinitely; a jam can last an hour. But a causal Transformer's attention cost grows with the history it attends to. If frame 90,000 (an hour in) had to attend over all 89,999 before it, real time would collapse. We need to bound the history without the music falling apart. That bound is sliding window attention (SWA).

Each frame attends only to the most recent w frames, a fixed-size window that slides forward. Older frames fall out of view. The cost per frame becomes constant (it depends on w, not on how long you've played), so the model can stream forever at steady speed. The implementation is a rolling cache of the keys and values each past token contributes (a "KV cache"): new entries are written in, entries older than w are evicted.

There's a notorious failure lurking, and MRT2 meets it head on. When the very first tokens of a stream slide out of the window, models tend to deteriorate sharply. Why would dropping ancient, long-irrelevant tokens hurt? Because those first tokens were acting as attention sinks.

The softmax inside attention forces the weights to sum to 1. Every query must put its attention somewhere, even when nothing is important. Models learn to dump that excess onto the first few tokens, a pressure-release valve. Those tokens become load-bearing for their role, not their content. Evict them, and every query's leftover attention has nowhere stable to go; quality craters.

MRT2's fix: a learnable attention-sink embedding, a few permanent trained "tokens" pinned at the start of the window that are never evicted. Every query gets a stable place to park its excess attention, while real musical history scrolls past. The sink stays; the music flows through.

Stream forever

Stopped

The tape is the frame stream; the bright band is the window of the last 50 frames. Press play and let it run past frame 50, when the first frames get evicted. Turn the sink off and listen to what happens next.

20

The sound is a dramatization: we degrade a clean loop in proportion to the quality meter, to make the collapse easy to hear.

One more subtlety: position. A Transformer needs some way to know token order. v1 used learned positional embeddings, which don't generalise past the length you trained on; fatal for a model meant to run arbitrarily long. The team tried RoPE (rotary position encoding), then leaned on a striking finding: with causal masking and a sliding window, a decoder can infer order implicitly, the NoPE ("no positional encoding") approach. The causal mask itself tells each token how far back things are, so explicit position signals can go, and the model generalises to any length. One constraint ties it together: the window is sized so the model's reach never exceeds the crop length it trained on, so it's never asked to extrapolate.

The two ingredients of forever. Sliding window attention bounds the compute: constant cost per frame however long you've played. Attention sinks plus NoPE bound the damage: the model stays coherent and correctly ordered as old frames evict. Together they turn a model that runs for a few seconds into one that streams indefinitely in bounded memory. That's the difference between a demo and an instrument.
What problem does the learnable attention-sink embedding solve in MRT2's sliding-window decoder?

Chapter 5

Steering the stream

Every control rides the same 40 ms clock as the audio

We can now generate endless, coherent music. But a fixed jam isn't an instrument. The point is that you steer it, live. This chapter is the spine of every control: how an outside signal gets into the generator fast enough to matter.

Formally we move from modelling P(x) to the conditional distribution Pθ,φ(x | c), where c is everything you're telling the model. MRT2 bundles three control streams:

cstyle
The vibe: a text prompt ("dreamy lo-fi") or a reference audio clip. Chapter 7.
cnotes
The pitches: which MIDI notes are sounding, from a keyboard or sequencer. Chapter 6.
cdrums
A drums on or off control. Chapter 8.

The most important decision about control is easy to skim past: every conditioning signal is tokenised at the audio frame rate, 25 Hz, the same 40 ms grid as the audio tokens. The notes you hold, the style embedding, the drum flag: each is sampled into one value per frame. That means a change can be absorbed by the next frame the model generates. If conditioning lived on a slower clock, say once per second, your input could wait up to a second to be seen, however fast the generator ran. Frame-rate conditioning is what turns Chapter 2's 40 ms granularity into 40 ms responsiveness.

Mechanically, the per-frame control values are concatenated into one conditioning vector for that frame, mapped into multi-channel embeddings, and injected into the temporal decoder through streaming cross-attention. Cross-attention means the generator's frame query attends to the conditioning embeddings, rather than to its own past. Streaming means it happens frame by frame as new control arrives, not once as a prompt at the start.

Three lanes, one clock

One column per 40 ms frame. At the playhead the three lanes are read, concatenated, and cross-attended into the temporal decoder, which emits that frame's 12 tokens. Switch a lane off and the model decides that axis for itself.

frame 14
The unifying principle. Put the controls on the same clock as the audio. Audio tokens tick at 25 Hz; so do the controls. That alignment is why "twist a knob" and "hear the result" sit a frame or two apart. The next three chapters are about what each lane carries and how to balance them, but they all ride this one 40 ms bus.
MRT2 tokenises every control signal at 25 Hz, the same rate as the audio frames. Why is matching that rate essential?

Chapter 6

Playing notes

The pianoroll, four tokens per pitch, and Auto-Strum

The notes lane, cnotes, is what lets you play MRT2 like an instrument: hold a chord on a MIDI keyboard and the model renders it in the current style. It needs a representation of "which notes are sounding right now" that lives on the 40 ms grid. That representation is a pianoroll.

Picture graph paper. The vertical axis has one row per MIDI pitch, 128 channels, from the lowest rumble to the highest ping. The horizontal axis is time, one column per frame. A cell is lit when its pitch sounds in that frame. That grid is cnotes.

Where do training pianorolls come from? MRT2 was trained on roughly 71,000 hours of instrumental stock music, but as audio, not MIDI. So the team ran a transcription model, MT3, over all of it to infer the notes. The model learns "these pitches, in this style, make this audio" from 71k hours of automatically transcribed examples.

A lit cell isn't enough information, though. Striking a note and holding one that's already ringing sound very different. So each pitch row, each frame, carries one of four tokens:

This vocabulary unlocks the signature note feature, Auto-Strum. Its two modes differ in who decides the attacks:

The model learns the first mode through onset-masking augmentation. During training, some onset and continuation tokens are randomly replaced with a special onset-mask token, hiding when notes were struck. Forced to produce plausible audio anyway, the model learns to invent musical attacks when onset information is missing. At inference, feed it masked onsets and it strums; feed it explicit onsets and it obeys. One trained behaviour, two playing styles.

Pianoroll

Stopped

One bar at 120 BPM: 16 steps, 2 seconds, 50 frames. Tap cells to place notes; touching cells in a row form one held note. Tap a note name to see that row's token stream below. Then play it with Auto-Strum off and on.

Concept to realization. The notes lane is not audio. It's a 128 × frames grid of 4-valued tokens that conditions the acoustic generator. The same chord pianoroll with cstyle = "grand piano" produces piano; with "fuzz guitar", guitar. The pianoroll says what pitches; the style says what it sounds like; the model fuses both into each frame's 12 RVQ tokens. That separation is why you can hold one chord and morph its timbre live.
With Auto-Strum on, what does the user supply and what does the model decide?

Chapter 7

The vibe

MusicCoCa, a frozen style space, and a one-step mapper

The style lane, cstyle, answers "what should it sound like?": genre, mood, instrumentation. You might specify style by text ("warm analog synthwave") or by an audio reference. The model needs one internal notion of style that both can map into. That shared space comes from MusicCoCa.

MusicCoCa embeds music and text about music into the same vector space, a contrastive captioning model for audio in the CLIP family. Train it so a clip of bossa nova and the words "relaxed bossa nova guitar" land near each other, and proximity means stylistic similarity whether a point came from audio or text. MRT2 uses MusicCoCa's quantised (RVQ) style embeddings as cstyle and keeps MusicCoCa frozen: its weights are not trained further inside MRT2.

Why freeze MusicCoCa? Because a stable style space is worth more than a marginally better one. If the style encoder kept shifting during MRT2's training, the meaning of any embedding would drift, and the generator would chase a moving target. Freezing pins the semantics: "dreamy" always means the same point, so the generator can learn a reliable mapping from that point to audio.

Freezing exposes a real problem: the train/test modality mismatch. During training, style usually comes from audio. At inference, users often give text. Even in a shared space, text and audio don't land in the same places: one prompt like "lo-fi piano" corresponds to many valid audio renditions, scattered across a region. Feed the generator a lone text point and it may sit slightly off the distribution of audio embeddings it trained on.

MRT2's fix is a small bridge network, a Pixel Mean Flow (pMF) mapper. It takes a text embedding and maps it into the distribution of plausible audio embeddings, learning that one-to-many relationship explicitly. Mean Flow is a generative technique, a cousin of flow matching and diffusion, tuned here for high-quality one-step inference: it jumps from the text point to a valid audio-style point in a single shot, essential inside a 40 ms budget. It's trained on short tags ("techno") and long captions ("driving four-on-the-floor techno with a detuned acid bassline") alike.

Style space

A flattened picture of the style space. Each teal point is a text prompt; its purple cloud is the audio that validly realises it. Notice the text points sit off their clouds. Pick a prompt: the mapper jumps, in one step, to a point inside the cloud, and you hear that rendition. Tap anywhere to hear the space itself.

In this toy, a point in the space sets our synth's filter, attack, and detune. In MRT2 the point is a MusicCoCa embedding that conditions the generator every frame.

Data flow recap. Text or audio → MusicCoCa (frozen) → style embedding. If the source was text, it also passes through the pMF mapper → a valid audio-style embedding. That becomes cstyle on the 25 Hz bus (Chapter 5), cross-attending into the generator every frame. Change the prompt mid-jam and the vibe follows within a frame or two.
Why does MRT2 keep MusicCoCa frozen and add a separate Mean Flow mapper for text prompts?

Chapter 8

The mixer

Guidance per signal, and masks as a paintbrush

Three controls ride the bus: style, notes, and the one we deferred, cdrums. This chapter explains drums, then shows how MRT2 lets you balance all three like channels on a desk, and leave channels deliberately blank.

You might expect drums to work like the pianoroll, with exact hits. But a drum hit is instantaneous, and the end-to-end reaction (the ~200 ms we keep meeting) is too slow to place individual kicks and snares tightly. So MRT2 transcribes drum stems from training audio with OaF Drums (Onsets and Frames for drums) and learns a frame-wise drum-presence signal. At inference cdrums is mainly a switch: generate with drums, or a drumless texture. "Drop the drums for this section, bring them back for the chorus."

How does one model both honour your controls and let you dial their strength, or switch one off? Classifier-free guidance (CFG), extended to several signals. Train the model to generate both with a condition and without it, by sometimes dropping the condition in training. At generation time you have two predictions, conditional and unconditional, and you extrapolate: push the output in the direction the condition pulls it, by an adjustable amount. A weight near 1 follows the control about as much as training did; higher exaggerates adherence; toward 0, it barely heeds it. MRT2 does this independently for each of the three signals, so you can crank note adherence while loosening style. Three guidance knobs, one stream.

That machinery is also how the drums switch works: drumless means running the drum signal's guidance toward its negative direction, steering away from drums rather than toward them.

Guidance desk

Stopped

Press play; the loop keeps running while you move the faders. The screen shows the melody you asked for (teal outlines) against what the model plays (warm). Pull notes guidance down and the pitches drift; push style past 8 and it overcooks; take drums to 0 for a drumless texture.

5
7
5

That seg control is the last idea, and the most creative: masking as a paintbrush. During training, MRT2 randomly masks contiguous regions of each control signal, sometimes a stretch of time, sometimes a band of pitches. The model learns to follow controls where they're given and improvise where they're blank. At inference that robustness becomes expressive:

Masking turns missing input from a bug into a dial for how much freedom you grant the model: full control at one end, open-ended jamming at the other.

The whole control system, in one breath. Three signals on a 25 Hz bus (Chapter 5), each independently weighted by guidance (how hard to follow it) and independently masked (where it applies at all). Weighting is each control's volume; masking is its footprint across time and pitch.
How does MRT2 let a musician follow their exact notes tightly while loosening the style, from a single model?

Chapter 9

The budget

Adding up 200 milliseconds

We've built every piece. Now let's account for the 200 ms. Here's the puzzle: the model generates a 40 ms frame at a time, so why is the end-to-end reaction ~200 ms and not ~40? Because reaction time is a chain, and the model's own step is only one link. Follow a single keypress through it:

  1. Input buffering. Your MIDI or audio doesn't arrive instantly; the OS and plugin collect it into a small buffer first.
  2. Temporal step (θ). The temporal Transformer attends over the window and makes the frame's context vector.
  3. Depth decode (φ). The depth Transformer unrolls the 12 RVQ tokens.
  4. Codec decode. SpectroStream turns 12 codes back into 40 ms of stereo waveform.
  5. Output buffering. The audio driver keeps samples queued ahead to avoid glitches.
  6. Host overhead. The DAW or app passing data around adds its own slice.

Add them up and you land near 200 ms, about 5× the frame. The model's compute (the three warm links) is the minority. The buffering at the edges is the real tax, the price of running glitch-free on a general-purpose laptop inside real audio software.

The 200 ms budget

Warm is the model; grey is plumbing. Tune the buffers and the model's speed, then press Hear your total: you tap, and the answer arrives after exactly the delay you built.

40 ms
60 ms
75 ms

The split between links is illustrative; the published figure is the ~200 ms total. Host overhead is held at 25 ms, and model compute divides roughly 45 / 35 / 20 between temporal step, depth decode, and codec.

The compute link stays small on a laptop because of the deployment stack. MRT2 ships as a C++ inference engine built on MLX, Apple's array framework for Apple Silicon, which compiles the model into a .mlxfn container that DAW plugins and standalone apps can load. The 2.4B-parameter base model streams in real time on an M3 Pro or M2 Max; a smaller 230M variant runs on any MacBook Air. (v1 needed a TPU or GPU in the cloud.) The architecture made 40 ms frames possible; MLX made them fast enough on hardware you own.

The payoff. Frame-level autoregression (Chapter 2) sets the floor at 40 ms. The two-Transformer split (Chapter 3) and sliding-window attention (Chapter 4) keep each frame cheap and constant-cost. Frame-rate conditioning (Chapter 5) makes control land in the next frame. MLX makes the compute fit a laptop. Stack the unavoidable buffers on top and you get ~200 ms, under the line where a human can play along. Every chapter was a term in this sum.
The model generates a 40 ms frame, yet end-to-end reaction is ~200 ms. Where does the extra ~160 ms mostly come from?

Chapter 10

Connections

The cheat sheet, and where MRT2 sits in the field

You can now read the Magenta RealTime 2 write-up and explain every line: why frames instead of chunks, why two Transformers, why attention sinks, why MusicCoCa is frozen, why the latency is 200 and not 40. Let's lock it in.

The one-paragraph summary

MRT2 turns 48 kHz stereo into 300 codec tokens per second with SpectroStream's 12-deep RVQ. A decoder-only model generates one 40 ms frame at a time: a temporal Transformer summarises the windowed past once per frame, a small depth Transformer unrolls the frame's 12 tokens. Sliding-window attention with a learnable attention sink (and NoPE) lets it stream forever at constant cost. Three controls ride a 25 Hz bus: style through frozen MusicCoCa plus a one-step Mean Flow mapper, notes through a 128-channel four-token pianoroll with Auto-Strum, and drums on or off. Each is weighted by its own classifier-free guidance and can be masked for creative freedom. It runs on Apple Silicon through an MLX C++ engine, reacting in ~200 ms: fast enough to jam.

The numbers that matter

QuantityValueWhy it matters
Frame rate fk25 Hz (40 ms per frame)The autoregressive unit, the floor on responsiveness
RVQ depth dc12 tokens per frameCoarse to fine; unrolled by the depth Transformer
Codec vocab Vc210 = 1,024Codes per token slot
Tokens per second25 × 12 = 300vs 96,000 raw samples: 320× compression
Bitrate~3 kbps at 48 kHz stereoSpectroStream compression
Pianoroll128 channels, 4 tokensoff, generic on, onset, continuation
Note training data~71k hours, MT3-transcribedWhere the pianoroll-to-audio mapping is learned
Parameters2.4B base, 230M smallvs v1's 760M and 220M
Control latency~200 ms (~15× vs v1)The whole point
HardwareM3 Pro or M2 Max; Air for 230MMLX C++ engine, .mlxfn

One frame of generation, as code

python# MRT2 generation loop (one frame), in pseudo-Python
def generate_frame(history, control, guidance, masks):
    # 1. CONTROL: sample each signal at this frame (25 Hz bus)
    c_style = mean_flow(musiccoca_text(control.prompt))           # frozen encoder + 1-step mapper
    c_notes = pianoroll_tokens(control.midi, auto_strum=control.strum)  # 128 ch x 4-token vocab
    c_drums = control.drums_on
    c = apply_masks(concat(c_style, c_notes, c_drums), masks)     # blank regions = freedom

    # 2. TEMPORAL: summarise the windowed past ONCE (SWA + sink + NoPE)
    ctx = temporal_theta(history[-W:], sink=learned_sink, cross_attend=c)  # cost set by W, not len(history)

    # 3. DEPTH: unroll 12 RVQ tokens, coarse to fine, each sees the coarser ones
    frame = []
    for j in range(12):
        logits = cfg_mix(depth_phi(frame, ctx), guidance)  # independent weight per signal
        frame.append(sample(softmax(logits)))

    # 4. CODEC: 12 codes -> 40 ms of 48 kHz stereo audio
    return spectrostream_decode(frame)                  # a' = Dec(x')

Where this sits in the field

Keep going

The takeaway. Real time wasn't one trick; it was a system. Shrink the unit (frames), make each unit cheap (two Transformers and a sliding window), keep it coherent forever (attention sinks and NoPE), put control on the same fast clock (the 25 Hz bus), make style, notes, and drums independently steerable (multi-signal guidance and masking), and compile it for the metal in your lap (MLX). Pull any one and the 200 ms falls apart. Latency is an architecture, not a setting.

Now press Present or Teach and explain the 200 ms budget back, out loud, from memory. If you can account for every link, you own this model. Then go back to the pads and play with the MRT2 partner one more time.

Magenta RealTime 2
Back to Gleams