TAI BUI
Back to curriculum
BuildPython

Music Generation — MusicGen, Stable Audio, Suno, and the Licensing Earthquake

By 2026, the generation problem is basically solved: Suno v5 and Udio v4 own commercial music generation, while MusicGen, Stable Audio Open, and ACE-Step lead the open-source side. What actually reshaped the field in 2025-2026 wasn't a new model. It was Warner Music's $500M settlement with Suno, and UMG's matching settlement with Udio.

TIME: ~75 minutesPREREQUISITES: Phase 6 · 02 (Spectrograms), Phase 4 · 10 (Diffusion Models)

Learning Objectives

  • Split music generation into its three sub-problems (instrumental, song generation with vocals, and conditional/controllable generation) and name a representative model for each.
  • Explain the two core architecture families, autoregressive token-LM over neural-codec tokens and diffusion over mel spectrograms or latents, including where each one wins and where it struggles.
  • Generate and evaluate music with MusicGen: plain text-to-music, melody-conditioned generation from a chromagram, and FAD/CLAP/ELO scoring against 2026 benchmarks.
  • Apply the 2025-2026 legal landscape (the Warner-Suno and UMG-Udio settlements, EU AI Act, California SB 942) to pick a safe-to-ship licensing strategy and avoid the pitfalls that still ship in 2026.

The Problem

Music generation takes a text prompt and turns it into a finished clip, anywhere from 30 seconds to 4 minutes, complete with lyrics, vocals, and structure. That splits into three sub-problems:

  1. Instrumental generation. Text like "lo-fi hip-hop drums with warm keys" becomes audio directly. MusicGen, Stable Audio, and AudioLDM live here.
  2. Song generation (with vocals and lyrics). "Country song about rainy Texas nights" becomes a full song, vocals included. Suno, Udio, YuE, and ACE-Step do this.
  3. Conditional / controllable generation. Extend an existing clip, regenerate just the bridge, swap genre, separate stems, or inpaint a section. Udio's inpainting plus stem separation is the feature every other 2026 platform is racing to match.
Warm-up0/3
1. What does a spectrogram of an audio clip show?Warm-up
A heat-map image of a 3-second clip. Three pairs of bright bands (each note and its octave overtone) step upward from left to right on a dark background. A colour bar runs from dark to bright, and question marks sit beside the vertical axis and the colour bar.
Computed with numpy from a synthetic clip of three notes (C4, E4, G4, one second each). The question marks stand for the unknowns.
2. How does a diffusion model generate a new sample at inference time?Warm-up
A Generate button, an arrow to a box labelled trained diffusion model with fixed weights at inference time, and an arrow to a small image labelled a new sample. A question mark sits on the second arrow.
Schematic. The output pattern is made up for illustration.
3. An autoregressive language model produces a long sequence. How does it do that?Warm-up
A prompt of four words, The weather today is, feeding a box labelled Language model, and below it a row of eight empty dashed slots for the output sequence.
Typed example, not captured from a real model.
Check: The Problem0/4
1. The lesson splits music generation into three sub-problems. Which of these is NOT one of them?Define
A text prompt feeding a model that outputs an audio clip of 30 seconds to 4 minutes, and below it three empty dashed cards labelled sub-problem 1, 2 and 3, each with a question mark.
Schematic of the lesson's opening description.
2. What is inpainting in music generation?Define
A song timeline split into Intro, Verse, Chorus, Bridge, Chorus and Outro, and below it an Inpaint button with an arrow to a dashed box labelled result of the Inpaint feature, followed by a question mark.
Schematic. The section layout is illustrative, not from a real track.
3. A teammate wants to regenerate only the bridge of an existing track and keep the rest. Which sub-problem is this?Explain
A song timeline of Intro, Verse, Chorus, Bridge, Chorus and Outro with the Bridge outlined in orange, and a request box reading regenerate only the bridge, keep everything else, with a question mark.
Schematic. The section layout is illustrative.
4. Your editor wants to redo only the bridge of a song and download the bass, drums, and vocals as separate files. Which model in the map fits?Design
An existing song feeds a box saying redo only the bridge, which leads to three separate files: bass.wav, drums.wav and vocals.wav. A question asks which model in the map fits.
Schematic of the request in the question.

The Concept

Music generation: token-LM vs diffusion, the 2026 model map

Every music-generation model comes down to one of two architecture families, or a closed-weight hybrid of both: autoregressive token language models predicting neural-codec tokens, and diffusion models running over mel spectrograms or latents.

Token LM over neural-codec tokens

Meta's MusicGen (2023, MIT) and its many derivatives condition on text or melody embeddings and autoregressively predict EnCodec tokens (32 kHz, 4 codebooks), then decode with EnCodec. Parameter counts run 300M to 3.3B. It's a strong baseline, but it struggles past 30 seconds.

ACE-Step (open-source, 4B XL, released April 2026) extends the same approach to full-song, lyric-conditioned generation. It's the open community's closest thing to Suno.

Diffusion over mels or latents

Stable Audio (2023) and Stable Audio Open (2024) run latent diffusion on compressed audio. Both excel at loops, sound design, and ambient textures, and neither is great at structured full songs.

AudioLDM / AudioLDM2 does text-to-audio through T2I-style latent diffusion, generalized to music, sound effects, and speech alike.

Hybrid (production): Suno, Udio, Lyria

These are closed weights, likely an autoregressive codec LM paired with a diffusion-based vocoder and specialized voice, drum, and melody heads. Suno v5 (2026) leads on quality at ELO 1293. Udio v4 adds inpainting plus stem separation, so bass, drums, and vocals download as separate files.

Evaluation

  • FAD (Fréchet Audio Distance). Embedding-level distance between the generated and real audio distributions, computed with VGGish or PANNs features. Lower is better: MusicGen small scores 4.5 FAD on MusicCaps, against a SOTA of ~3.0.
  • Musicality (subjective). Human preference. Suno v5 leads at ELO 1293.
  • Text-audio alignment. The CLAP score, a contrastive text-audio embedding (the audio analog of CLIP), between prompt and output.
  • Musicality artifacts. Off-beat transitions, vocal-phrase drift, and loss of structure past 30 seconds.
Check: The Concept0/10
1. What is FAD (Fréchet Audio Distance)?Define
A scatter of blue dots for real recordings and orange dots for generated clips, two overlapping but offset clouds, with a box on the right reading FAD (Fréchet Audio Distance) equals a question mark.
Schematic: the dots are random numbers drawn to illustrate two sets of clips, not real audio features.
2. What are stems in music generation?Define
Four download rows, each with a file name and a waveform: full mix, bass, drums and vocals, all as wav files.
Schematic of a download panel. File names are typed and the waveforms are random shapes, not real audio.
3. What is CLAP in the evaluation of generated music?Define
A box with the text prompt lo-fi hip-hop drums with warm keys, a box with a waveform for the generated clip, and a wide box reading CLAP of this clip equals a question mark.
Schematic. The prompt is the lesson's example; the waveform is a random shape.
4. What is EnCodec in MusicGen?Define
A chain of three boxes: Text prompt, MusicGen with 300M to 3.3B parameters, and Audio you can play. Below MusicGen is a separate box labelled EnCodec joined by a dashed line carrying a question mark.
Schematic.
5. How does MusicGen generate audio?Explain
Seven lines of Python from the lesson that load MusicGen small, set a duration, call model.generate with a synthwave prompt and save the result to out.wav. The generate line is highlighted.
Code copied from the lesson.
6. How are ACE-Step and AudioLDM/AudioLDM2 built architecturally?Explain
Two cards. ACE-Step XL: April 2026, 4B, Apache-2.0, architecture unknown. AudioLDM / AudioLDM2: architecture unknown.
Facts are from the lesson's model map and concept sections.
7. Which kind of job plays to the strength of latent-diffusion models like Stable Audio Open?Explain
A card for Stable Audio Open from 2024 with 1.2B parameters, latent diffusion on compressed audio, a Stability non-commercial license, and a best-at field marked with a question mark.
Facts are from the lesson's model map and concept sections.
8. How are closed production systems such as Suno, Udio, and Lyria likely built?Explain
Three cards for Suno v5, Udio v4 and Lyria 3. Each shows closed weights, unknown parameter count, a length (4 min, 4 min, real-time) and an unknown design.
Facts are from the lesson's model map and concept sections.
9. What do the CLAP score and a musicality ELO each measure?Explain
Two stacked rows on an evaluation sheet. CLAP score and Musicality ELO, where Suno v5 has 1293. Each has a question mark for what it measures.
Figures are from the lesson.
10. Two models score FAD 4.5 and FAD 2.9 against the same reference set. Which one produces audio closer to real recordings?Apply
Two cards. Model A has FAD 4.5 and Model B has FAD 2.9, both against the same reference set.
Numbers are from the question.

2026 model map

ModelParamsLengthVocalsLicense
MusicGen-large3.3B30 snoMIT
Stable Audio Open1.2B47 snoStability non-commercial
ACE-Step XL (Apr 2026)4B> 2 minyesApache-2.0
YuE7B> 2 minyes, multilingualApache-2.0
Suno v5 (closed)?4 minyes, ELO 1293commercial
Udio v4 (closed)?4 minyes + stemscommercial
Google Lyria 3 (closed)?real-timeyescommercial
MiniMax Music 2.5?4 minyescommercial API
Check: 2026 model map0/2
1. Which model in the 2026 model map is Apache-2.0, has 7B parameters, and makes multilingual vocals over two minutes long?Apply
A one-row table with columns Model, Params, Length, Vocals and License. The model cell is a question mark and the other cells read 7B, over 2 minutes, yes multilingual, Apache-2.0.
Row built from the question's constraints.
2. You ship a paid app with ambient instrumental loops, and the team has no legal reviewer. Which choice fits best?Design
A card for a paid app with ambient instrumental loops, commercial use and no legal reviewer on the team, followed by a question about which model fits.
Requirements restated from the question.

The legal landscape (2025-2026)

  • Warner Music vs. Suno settlement. $500M. The settlement gives WMG oversight of AI likeness, music rights, and user-generated tracks on Suno, and UMG landed a similar settlement with Udio.
  • EU AI Act and California SB 942. Both now require disclosure when music is AI-generated.
  • Riffusion and MusicGen, both MIT-licensed, carry no compliance baggage, but they also don't do commercial-grade vocals.

Safe-to-ship patterns:

  1. Generate instrumental only (MusicGen, Stable Audio Open, MIT/CC0 outputs).
  2. Use commercial APIs (Suno, Udio, ElevenLabs Music) with a per-generation license.
  3. Train on an owned or licensed catalog, which is where most enterprises end up.
  4. Tag every generation with watermarks and metadata.
Check: The legal landscape (2025-2026)0/5
1. Which 2025-2026 events reshaped music generation alongside the technical progress?Define
Two panels. The left lists technical progress: Suno v5, Udio v4 with inpainting and stems, and ACE-Step XL in April 2026. The right is a dashed panel asking what else reshaped the field, with a question mark.
Facts are from the lesson.
2. What do the EU AI Act and California SB 942 mean for a music-generation product?Explain
A Music app box that takes a text prompt and outputs a clip, with two labels, EU AI Act and California SB 942, pointing to a dashed box about what the app must do and a question mark.
Schematic.
3. Which list matches the four safe-to-ship patterns for music generation?Explain
A checklist with four numbered dashed rows, each containing only a question mark, headed launch checklist: safe-to-ship patterns.
Schematic of the lesson's four-item list with the contents hidden.
4. A team's demo went down well, and they plan to run the legal review after launch. According to the lesson's reasoning, what is the flaw?Analyze
Four boxes in order: Build demo, Demo goes well, Launch, and Legal review (highlighted). A question mark asks about the flaw in the plan.
Schematic of the plan described in the question.
5. A company wants 4-minute songs with vocals for users in the EU and California. Which plan fits the lesson's advice?Design
A card for a song product that makes 4-minute songs with vocals for users in the EU and California, followed by a question about which plan fits.
Requirements restated from the question.

Build It

Step 1: generate with MusicGen

python
from audiocraft.models import MusicGen
import torchaudio
 
model = MusicGen.get_pretrained("facebook/musicgen-small")
model.set_generation_params(duration=10)
wav = model.generate(["upbeat synthwave with driving drums, 128 BPM"])
torchaudio.save("out.wav", wav[0].cpu(), 32000)

Three sizes ship: small (300M, fast), medium (1.5B), and large (3.3B). small is enough to answer "does the idea land."

Step 2: melody conditioning

MusicGen-melody takes a chromagram (a 12-dimensional, per-frame pitch representation) as input and preserves the tune while it swaps out the timbre, so "give me this melody as a string quartet" is exactly the kind of request it's built for.

python
melody, sr = torchaudio.load("humming.wav")
wav = model.generate_with_chroma(
    ["jazz piano cover"],
    melody.squeeze(),
    sr,
)

Step 3: FAD evaluation

python
from frechet_audio_distance import FrechetAudioDistance
fad = FrechetAudioDistance()
 
fad.get_fad_score("generated_folder/", "reference_folder/")

It computes VGGish-embedding distance, which is useful for genre-level regression tests, but it's no substitute for human listeners.

Step 4: adding to the LLM-music workflow

Combine this with the ideas from Lessons 7-8:

python
prompt = "Write a 30-second jazz loop. Describe the drums, bass, and piano voicing."
description = llm.complete(prompt)
music = musicgen.generate([description], duration=30)
Check: Build It0/7
1. What is a chromagram?Define
A heat-map with twelve rows labelled C, C sharp, D and so on up to B. A bright cell moves from the C row to the E row to the G row from left to right. A question mark sits to the right.
Computed with numpy from a synthetic clip of three notes (C4, E4, G4, one second each).
2. Why does melody conditioning take a chromagram rather than the raw hummed recording?Explain
A chain: humming.wav, a highlighted box labelled chromagram, a MusicGen melody box, and a jazz piano cover output. A question mark asks why the chromagram step is there.
Schematic.
3. Why is a FAD score best used for genre-level regression tests and not as the final verdict on quality?Explain
Four lines of Python that build a FrechetAudioDistance object and call get_fad_score on generated_folder and reference_folder. Below are the lesson's reported scores of 4.5 for MusicGen small and about 3.0 for the state of the art.
Code and figures copied from the lesson.
4. After the Step 1 code runs, what does `out.wav` contain?Apply
Seven lines of Python from the lesson. Lines five and seven are replaced with hidden-line placeholders in dashed boxes. The other lines load MusicGen small and call model.generate on a synthwave prompt.
Code copied from the lesson, with two lines hidden.
5. You only want to check whether a prompt idea lands before spending more compute. Which MusicGen size does the lesson point to?Apply
A bar chart of the three MusicGen sizes: small 0.3B, medium 1.5B and large 3.3B parameters.
Sizes are from the lesson (300M, 1.5B, 3.3B).
6. You run the Step 2 code with humming.wav and the prompt 'jazz piano cover'. What do you get?Apply
Six lines of Python from the lesson that load humming.wav and call generate_with_chroma with the prompt jazz piano cover, the squeezed melody and the sample rate.
Code copied from the lesson.
7. In the Step 4 workflow, what does the LLM's output do?Apply
Four lines of Python from the lesson: a prompt asking for a 30-second jazz loop, a call to llm.complete, and a musicgen.generate call whose first argument is hidden behind question marks.
Code copied from the lesson, with the argument of generate hidden and the first line wrapped.

Use It

GoalStack
Instrumental sound designStable Audio Open
Game / adaptive musicGoogle Lyria RealTime (closed)
Full songs with vocals (commercial)Suno v5 or Udio v4 with explicit license
Full songs with vocals (open)ACE-Step XL or YuE
Short ad jingleMusicGen melody-conditioned on a hummed reference
Music-video backgroundMusicGen + Stable Video Diffusion
Check: Use It0/2
1. Which stack does the Use It table give for game or adaptive music, and which for a short ad jingle?Apply
A two-row table with columns Goal and Stack. The goals are game or adaptive music and short ad jingle, and both stack cells are question marks.
Goal names copied from the lesson's Use It table.
2. Which open-weight stack does the Use It table give for full songs with vocals?Apply
A one-row table with columns Goal and Stack. The goal is full songs with vocals, open, and the stack cell is a question mark.
Goal name copied from the lesson's Use It table.

Pitfalls that still ship in 2026

  • Copyright-laundering prompts. Commercial platforms filter out prompts like "song in the style of Taylor Swift" now; Suno and Udio both do it. Open models don't, so add your own filter list.
  • Repetition / drift past 30 s. AR models loop past that point. Crossfade multiple generations, or use ACE-Step for structural coherence.
  • Tempo drift. Models wander off the target BPM. Tag the BPM in the prompt and post-filter with librosa's beat_track.
  • Vocal intelligibility. Suno is excellent at this; open models are often mushy on words. If the lyrics matter, reach for a commercial API or fine-tune.
  • Mono output. Open models generate mono, or fake stereo. Fix it with a proper stereo reconstruction step, like ezst or Cartesia's stereo diffusion.
Check: Pitfalls that still ship in 20260/4
1. What do open models tend to do with vocals and channel layout?Explain
A song.wav card for an open model's output with a waveform, and two rows, sung words and channel layout, each marked with a question mark.
Schematic. The waveform is a random shape.
2. A 90-second MusicGen-large track repeats the same few bars after 30 seconds, and the tempo has drifted off target. What is going on and what fixes it?Analyze
A timeline from 0 to 90 seconds. The first third has six differently coloured bars of music, and the rest repeats the same three colours. Below, grey target beat marks and orange generated beat marks drift apart toward the right.
Schematic of the situation in the question. Colours and drift amount are illustrative.
3. Your test users loved 'song in the style of Taylor Swift' prompts on Suno, and you switch to an open model for launch. What do you need to add?Analyze
Two boxes, test on Suno where users loved the prompt, and launch on an open model with the same prompt, and a prompt box reading song in the style of Taylor Swift. A question mark asks what to add before launch.
Schematic of the situation in the question.
4. Your open-model demo sings, but listeners cannot make out the words, and the lyrics are the point of the product. What does the lesson suggest?Analyze
A demo card with a waveform. Listeners hear the melody but the words are unclear, while the product requirement is that the lyrics are the point. A question mark asks what the lesson suggests.
Schematic of the situation in the question; the waveform is a random shape.

Ship It

Save it as outputs/skill-music-designer.md. Pick the model, the license strategy, a length and structure plan, and the disclosure metadata your deployment needs.

Author's Note

The technical half of this lesson is the easy half. Anyone can have MusicGen or ACE-Step generating something listenable by the end of an afternoon. What actually kills music-gen projects in 2026 is skipping the legal review until after the demo ships, then finding out the "in the style of X" prompts your test users loved are the exact pattern that just cost Suno and Udio $500M-plus in settlements. Default to instrumental-only or a licensed commercial API until someone on the team has actually read the consent and disclosure rules for your market. It's the boring choice, and it's also the one that doesn't end with a call from legal.

Exercises

  1. Easy. Run code/main.py. It produces a "generative" chord progression and drum pattern as ASCII symbols, a music-gen cartoon you can play back through any MIDI renderer if you want.
  2. Medium. Install audiocraft, generate 10-second clips across 4 genre prompts with MusicGen-small, and measure FAD against a reference genre set.
  3. Hard. Using ACE-Step (or MusicGen-melody), generate three variations of the same tune with different timbre prompts, then compute CLAP similarity to the prompt to verify alignment.

Key Terms

TermWhat people sayWhat it actually means
FADAudio FIDFréchet distance between embedding distributions of real vs generated.
ChromagramMelody as pitches12-dim per-frame vector; input to melody conditioning.
StemsInstrument tracksSeparated bass / drums / vocals / melody as WAV.
InpaintingRegen a sectionMask a time window; model regenerates just that.
CLAPText-audio CLIPContrastive audio-text embedding; eval text-audio alignment.
EnCodecMusic codecMeta's neural codec used by MusicGen; 32 kHz, 4 codebooks.

Further Reading

Code

Ships With