MONA explainer 11 min read

What Is AI Music Generation and How Text-to-Audio Models Convert Prompts into Full Tracks

Abstract visualization of audio waveforms decomposing into discrete token sequences on a neural spectrogram grid

ELI5

AI music generation converts a text description — “sad cello duet, minor key” — into a complete audio track by encoding sound as sequences of discrete numbers and predicting what those numbers should be, given your description.

Type “melancholic jazz piano, 90 BPM” into a modern AI music system and you’ll have a full track in under a minute — the swing feel subtly off-kilter, the room ambience suggesting a close-miked studio, the left-hand voicings low and wide. The common intuition is that this works like a very sophisticated retrieval system: the model has “heard” everything and reassembles it. That intuition is wrong, and the correct explanation is considerably stranger. The model never retrieved a single sample of audio. It predicted sequences of integers. The part that sounds like musical intuition is a consequence of very large-scale statistical regularity — and understanding that distinction is the only way to understand what these systems can and cannot do.

The Token Layer: How Audio Becomes a Sequence Problem

Sound is a continuous signal: pressure waves varying over time at frequencies our ears resolve as pitch, timbre, and rhythm. A transformer model can’t process a continuous signal directly — it operates on discrete tokens, one at a time, attending to their relationships. Audio tokenization made music a sequence problem — and that reframing is what unlocked the current generation of models.

What is AI music generation?

AI music generation is the automated synthesis of music — melody, harmony, rhythm, timbre, and in most current systems, vocals — from machine-readable inputs, typically a text prompt or a style descriptor.

The field has prior lives. Algorithmic composition (1950s–1970s) encoded musical rules by hand. Procedural MIDI generation (1990s) assembled symbolic musical events — note on, note off, instrument assignment — without touching the acoustic signal. Concatenative synthesis (early 2000s) went further, splicing short segments of recorded audio to form new sequences. What changed in the 2020s was the substrate. Instead of operating on symbols that represent musical events, current models synthesize the acoustic waveform itself. Every breath before a lyric, the resonance characteristic of a specific instrument body, the tape saturation on a snare hit — these are not retrieved from a library. They emerge from a decoder’s learned ability to reconstruct perceptually coherent audio from compressed representations.

The mechanism that made this shift possible is the Neural Audio Codec: a learned compression algorithm trained to encode a continuous waveform into a sequence of discrete integer codes (tokens) and decode those tokens back into audio with minimal audible loss. EnCodec — a streaming encoder-decoder architecture using a vector-quantized variational autoencoder with Residual Vector Quantization — is the foundational academic example, described by Défossez et al. in “High Fidelity Neural Audio Compression” (arXiv, Défossez et al.).

Once a codec exists, the generation problem becomes a sequence prediction problem. And sequence prediction is what transformers do.

It helps to see what was used before neural codecs to understand why they matter. Earlier neural audio systems encoded waveforms as a Mel Spectrogram: a frequency-over-time matrix structured around the nonlinear sensitivity of human hearing. The mel-spectrogram was compact and perceptually meaningful, but it wasn’t discrete — and converting it back to a waveform required a separate Vocoder, a signal-processing network that reconstructs audio from a spectral representation. The two-stage stack (spectrogram → vocoder) introduced artifacts and complexity. A neural codec collapses both stages into one learned system, producing discrete tokens that decompress cleanly.

Not two stages. One.

From Prompt to Waveform: The Generation Step

Text goes in. Audio comes out. Between those two facts, generation is where the architectures diverge — producing very different trade-offs in quality, controllability, and long-range coherence depending on which approach the model takes.

How do AI music generation models turn a text prompt into an audio track?

Stage 1 — Text encoding. The input prompt (“upbeat synth-pop, 120 BPM, major key, female vocals”) passes through a text encoder — often a contrastive model trained on paired audio-text data — that maps the description into a dense conditioning vector. This vector biases the probability distribution over audio tokens; it shifts what the model considers “likely next” toward outputs that semantically match the description. The text encoder doesn’t generate anything. It recalibrates the generation process.

Stage 2 — Token sequence generation. This is where the two dominant paradigms diverge.

The first is autoregressive generation: predict audio tokens left-to-right, one at a time, conditioned on all preceding tokens plus the text embedding. MusicGen, developed at Meta AI and published at NeurIPS 2023, is the clearest research-grade example — a single-stage autoregressive transformer language model operating over discrete EnCodec tokens (Copet et al., arXiv:2306.05284). At each step, it assigns probability to the next token based on the full preceding context and the conditioning signal. The constraint is sequential: generating 30 seconds of audio at 50 tokens per second requires predicting roughly 1,500 tokens in order, with no ability to parallelize within a single generation pass.

Audio Diffusion models invert this logic. Rather than predicting tokens left-to-right from silence, they start with pure noise in a compressed latent space and iteratively subtract that noise, conditioned on the text embedding, until a plausible audio structure emerges. Stable Audio Open — a 1.32B parameter model using a VAE encoder and Diffusion Transformer backbone producing 44.1 kHz stereo output (per arXiv:2406.19388) — exemplifies this approach. Diffusion enables parallelism during inference: instead of generating one token at a time, the denoising process operates over the full latent simultaneously. The trade-off is temporal coherence; reproducing a melodic motif that appeared 30 seconds earlier requires the model to have encoded that relationship in its latent representation, and that encoding degrades with distance in ways that autoregressive models handle more naturally by attending to prior tokens directly.

Stage 3 — Decoding. The generated token sequence — whether from an autoregressive run or a diffusion denoising pass — passes through the audio codec decoder, which reconstructs the waveform. At this stage, acoustic phenomena that were never explicitly specified emerge from the decoder’s learned generalization: room acoustics, the natural decay envelope of an instrument, the subtle pitch variation in a human vocal performance. The Prosody of a generated vocal line — its rhythm, stress, and expressive contour — arises not from phoneme-by-phoneme planning but from the statistical regularity captured in the latent representation.

Vocal generation sits at the edge of both music synthesis and Text-to-Speech architectures. TTS systems optimize for phoneme-accurate reproduction of speech, conditioning on Phoneme sequences to control articulation precisely. Music generation models must handle both instrumental audio and vocal audio within a shared latent space, conditioning primarily on textual style descriptors rather than phoneme-level specifications. Voice Cloning pushes further: it conditions the generation on a reference audio sample to anchor the output to a target speaker’s timbre and phrasing. Suno v5.5, released March 26, 2026, added this capability as a core feature under the “Voices” label, allowing users to condition generation on their own vocal samples (Suno Blog).

Mureka’s V9 model introduces a structurally distinct approach to Stage 2: MusiCoT (Music Chain-of-Thought), which generates an explicit song plan — key, tempo, section order, instrumentation — before committing to audio tokens, according to Mureka Docs. The parallel to chain-of-thought prompting for language reasoning is direct: by externalizing the compositional plan into an intermediate representation, the model constrains subsequent token prediction to a structurally narrower distribution. Instead of learning song structure implicitly through token statistics, MusiCoT makes structure a first-class object that the model must produce before generating audio.

Side-by-side diagram of two AI music generation pipelines: autoregressive (text encoder to left-to-right token prediction to audio decoder) and diffusion (text encoder conditioning iterative noise-to-latent denoising to audio decoder)
Both paradigms share the text encoding and audio decoding stages; they differ in how the middle generation step works — one predicts tokens sequentially, the other iteratively denoises from noise.

What the Architecture Predicts About Failure

The two paradigms fail differently, and failure mode follows architecture, not chance.

In an autoregressive model, the failure mode is local coherence at the expense of global structure. Each token is predicted based on immediately preceding context, which means a generated piece can lose its tonal center mid-track, modulate unexpectedly, or drift in tempo without any explicit mechanism to prevent it. The model has a well-calibrated probability over the next token; it has no explicit representation of “where this song is going.” If you observe a track that sounds convincing measure-by-measure but falls apart across the full arc, you’re looking at this failure mode.

In a diffusion model, the failure runs in the opposite direction: strong audio texture, weaker temporal consistency. If you observe a track that sounds sonically rich but struggles to establish and return to a theme, you’re likely looking at a diffusion model whose latent representation didn’t capture the relationship between distant sections.

If a prompt specifies a specific mood or emotional arc (“starts hopeful, ends uncertain”), autoregressive models tend to handle the instruction more literally — because the conditioning signal can influence each prediction step directly. Diffusion models condition the full denoising process, which can produce a more globally cohesive texture but responds less precisely to fine-grained textual instruction.

Music Copyright And AI represents a constraint that operates at a different layer — not on generation quality but on what training data is permissible and what commercial rights attach to generated output. As of June 2026, Suno faces an ongoing Sony/RIAA lawsuit with a key fair-use ruling expected in July 2026; Udio settled with Universal Music Group in October 2025 under a per-generation royalty model (TechCrunch). The outcome of the Sony case may materially alter what training data practices are legally defensible across the industry.

Rule of thumb: autoregressive models hold long-range musical structure better; diffusion models produce cleaner audio textures. Neither solves the copyright question — that resolution is external to the architecture.

When it breaks: the consistent weakness across both paradigms is explicit musical form — a generated track can sound convincing at the local level (phrase, measure, instrument texture) while failing to build, develop, and resolve the way a composed piece does, because neither architecture maintains an explicit representation of the track’s overall compositional arc.

The Data Says

The shift from symbolic music generation to direct audio synthesis was enabled by one architectural insight: audio can be discretized into compact token sequences without destroying the perceptual properties that make it sound like music. Once sound is a sequence, it is a prediction problem — and large-scale prediction is what neural networks do. The autoregressive and diffusion paradigms represent different bets on where to concentrate computational effort: temporal coherence versus acoustic texture. Neither has converged on the other’s strength. The research, and the legal frameworks around training data, are still in motion.

AI-assisted content, human-reviewed. Images AI-generated. Editorial Standards · Our Editors