Lunar Boom Learning

Chapter 3

Chapter 3

How an AI Model Generates Music

From probability and token sequences to diffusion, control, and complete song structure

Chapter 1 showed how music becomes machine-readable representations, and Chapter 2 showed how those representations become training examples. This chapter follows the next step: how a trained model turns context, probability, noise, and control signals into new music.

About 79 minutes

What you’ll learn

  1. Explain how context becomes a probability distribution over possible musical events.
  2. Describe how autoregressive models build music through dependent token decisions.
  3. Explain how hierarchical systems separate long-range content from acoustic detail.
  4. Describe how diffusion models generate audio through repeated denoising.
  5. Compare text, melody, harmony, rhythm, lyrics, timing, and reference-audio conditioning.
  6. Distinguish generation, continuation, outpainting, inpainting, and variation.
  7. Explain why long-form coherence requires memory, repetition with variation, structural planning, transitions, and deliberate endings.

Questions to carry with you

  1. How does a model decide what musical event or audio representation should come next?

  2. How do autoregressive and diffusion models generate music differently?

  3. Why do some systems separate semantic structure, coarse sound, and fine acoustic detail?

  4. How do prompts, melodies, chords, lyrics, timing, and reference audio guide generation?

  5. What happens when several conditioning signals conflict?

  6. Why can a convincing short clip become repetitive or lose direction over several minutes?

  7. How can a model preserve motifs, section identity, and song form across a complete track?

Sections

6 sections

Chapter recap

Chapter takeaway

Chapter 3 follows the full generation path. It begins with one probabilistic prediction, turns that prediction into an autoregressive sequence, separates structure and sound through hierarchy, contrasts token generation with diffusion, adds user control through conditioning, and ends with the unresolved challenge of organising complete songs.

  1. A generative model does not choose music with certainty. It assigns probabilities or denoising directions based on context and conditions.

  2. Autoregressive models build music through a chain of dependent token choices, so early decisions influence everything that follows.

  3. Hierarchical systems divide long-range content and acoustic detail across different representations or model stages.

  4. Diffusion models generate by repeatedly refining noise in waveform, spectrogram, or latent space rather than selecting one left-to-right token path.

  5. Conditioning can guide text, melody, harmony, rhythm, lyrics, timing, style, continuation, and editing, but conflicting controls must be resolved.

  6. Generating several minutes of audio is not the same as generating a coherent song with recognisable sections, purposeful development, and a convincing ending.

Chapter 3 explained what happens during generation. Chapter 4, Training and Fine-Tuning a Music Model, examines how the model's parameters learn these behaviours, how objectives and optimisation shape the result, and how existing models can be adapted to new musical tasks.

Check your understanding

Chapter 3 Assessment

Review prediction, autoregressive generation, hierarchical modelling, diffusion, conditioning, editing, and long-form musical structure.