Lunar Boom Learning

3.5 · Conditioning and Control

Section 3.5 of 3.6

Conditioning and Control

Guiding what the model generates

Learn how text, melody, harmony, rhythm, lyrics, timing, and reference audio guide music generation, and how continuation and inpainting turn generation into editing.

About 14 minutes

Guiding question

How does a control signal enter a generative model?

By the end, you’ll be able to
  • Define conditioning and explain how it changes a model's output distribution.
  • Distinguish global controls from time-aligned local controls.
  • Compare text, melody, harmony, rhythm, lyrics, duration, and reference-audio conditioning.
  • Explain the difference between generation, continuation, outpainting, and inpainting.
  • Identify conflicts that can occur when several control signals are combined.
  • Explain why controllability depends on training data, representations, and model architecture.

The previous sections explained how a model generates music. Conditioning explains how a user, dataset, or external signal directs that process.

Without conditioning, a model samples from the overall patterns it learned during training. With conditioning, it changes the probabilities or denoising updates so the output is more likely to follow a prompt, melody, chord sequence, rhythm, duration, lyric sheet, or reference recording.

Conditioning does not usually dictate every detail. It narrows the space of possible results.

Common music conditioning signals

Swipe sideways to view the full comparison

ConditionWhat it can guideTypical representation
TextGenre, mood, instrumentation, production, context, or intended useText embeddings
MelodyPitch contour and melodic movementChromagram, MIDI, note events, or audio-derived features
Chords and harmonyHarmonic progression and local tonal contextChord labels or time-aligned symbolic features
Rhythm and drumsBeat placement, rhythmic density, groove, or drum patternBeat sequence, symbolic rhythm, or separated drum audio
TempoOverall pace or beat rateBPM value, tempo class, or text attribute
LyricsWords, vocal content, and sometimes phrase orderText tokens with optional alignment
Duration and timingOutput length and position within a generated segmentTiming embeddings or duration values
Reference audioStyle, timbre, instrumentation, melody, or continuation contextAudio embeddings, codec tokens, or bottleneck features

Global and local conditioning

A global condition applies broadly to the complete output. A prompt such as warm acoustic folk with intimate vocals describes the overall result.

A local condition changes over time. A chord sequence may specify one chord for the first bar and another for the second. A drum condition may place individual hits at precise moments.

Global conditions are easier to attach to an entire generation. Local controls require alignment between the condition and the generated timeline.

Text prompts

Text is a flexible interface because it can combine many ideas in one description:

Slow cinematic piano with restrained strings, gradually becoming tense and percussive.

A text encoder converts the prompt into numerical features. The generative model then uses those features while predicting tokens or refining a latent.

Text works well for broad musical direction, but ordinary language is often ambiguous. Words such as dark, epic, or vintage do not correspond to one fixed acoustic result.

Prompt detail and control

Swipe sideways to view the full comparison

PromptInformation suppliedLikely limitation
Piano musicOne broad instrument categoryTempo, mood, style, and production remain open
Slow intimate solo pianoInstrument, pace, arrangement, and moodHarmony and exact melody remain open
Slow intimate solo piano in a spacious room, sparse notes, soft pedal noiseInstrument, pace, arrangement, environment, density, and productionThe model may still interpret subjective words differently
Play this exact melody at 72 BPM using intimate solo pianoText, melody, tempo, and instrumentationRequires a model that supports every stated condition

Melody conditioning

A melody condition gives the model information about pitch movement over time.

The model does not necessarily copy the original recording. It may preserve the melodic contour while changing the instruments, harmony, texture, or production.

MusicLM demonstrated that a hummed or whistled melody could be transformed according to a text description. MusicGen can also combine text with melodic features extracted from audio.

Examples in practice

Real-world example: MusicLM

MusicLM can receive both a text caption and a melody. Its paper demonstrates transformations of hummed and whistled melodies into styles described by text, including instrumental and genre changes.

Real-world example: MusicGen

MusicGen supports text-conditioned and melody-conditioned generation. In the melody-conditioned version, melodic features from audio are combined with text while the model generates compressed music tokens.

Harmony, rhythm, tempo, and key

Text can mention musical attributes, but specialised controls can express them more directly.

A chord condition can specify when harmonies should change. A rhythm condition can identify beat or drum events. Tempo can be represented as a BPM value, while key can be supplied as a symbolic label.

These controls are useful when a general prompt is not precise enough for arranging, accompaniment, or synchronisation tasks.

Examples in practice

Real-world example: JASCO

JASCO combines global text descriptions with time-aligned symbolic and audio controls. The system was evaluated with chord, melody, separated drum-track, and full-mix conditions, allowing local structure and global style to guide the same generation.

Real-world example: Mustango

Mustango extends text-to-music diffusion with music-specific controls. Its prompts can contain instructions related to chords, beats, tempo, and key, giving the model more explicit musical guidance than a general caption alone.

Real-world example: MuseCoco

MuseCoco generates symbolic music by using musical attributes as a bridge between text and note sequences. Because the output is symbolic, attributes and individual notes can be edited more directly than in a finished waveform.

Control in symbolic and audio generation

Swipe sideways to view the full comparison

AreaSymbolic representationAudio representation
Pitch editingIndividual notes can be changed directlyPitch is entangled with timbre and performance
Chord controlChord labels can align with bars and note eventsThe model must render the harmony into realistic sound
InstrumentationInstrument tracks can be assigned explicitlyInstrument identity is represented acoustically
Production detailUsually limitedCan include room sound, distortion, texture, and mixing
Post-generation editingStraightforward in MIDI or score formOften requires regeneration, source separation, or inpainting

Lyrics conditioning

Lyrics provide the words that a singing model should produce. They do not automatically specify the melody, rhythm, pronunciation, voice, or placement of each syllable.

A system may receive unaligned lyrics, where only the text order is known, or aligned lyrics, where words, phonemes, or syllables are connected with time positions.

More precise alignment can improve control, but it requires more detailed training data.

In practice

Real-world example: Jukebox

Jukebox conditions its top-level music prior on artist and genre metadata and can also receive unaligned lyrics. The lyrics improve vocal control, but the model must still learn how words relate to timing and melody without exact word-level alignment.

Duration and timing

A request for 30 seconds of audio is different from a request for 90 seconds. The model needs to know not only what to generate, but how much temporal space is available.

Stable Audio introduced timing conditioning using the requested duration and the position of the sampled training segment inside its source recording. This lets the model generate variable-length outputs and learn that beginnings, middles, and endings may have different musical roles.

In practice

Real-world example: Stable Audio

Stable Audio conditions its latent diffusion model on text and timing embeddings. These timing signals support variable-length generation and help the model distinguish where a training segment occurred within a longer recording.

Reference audio

A reference recording can guide several different properties. One system may use it as a melody. Another may extract style, timbre, instrumentation, rhythm, or continuation context.

The phrase audio conditioning therefore does not describe one fixed task. The model architecture and feature extractor decide which information is preserved and which information is discarded.

In practice

Real-world example: MusicGen-Style

MusicGen-Style uses a short audio excerpt as a style condition and can combine it with text. Its discrete bottleneck is designed to preserve useful style information while limiting direct copying of the reference content.

When conditions conflict

Suppose the controls request:

    1. A slow ambient texture
    2. A drum pattern at 150 BPM
    3. A gentle lullaby melody
    4. Aggressive distorted production
    5. A duration of eight seconds

The system cannot satisfy every interpretation equally. Some conditions may dominate, while others are weakened or ignored.

Conflict is especially likely when a global text prompt and a local symbolic condition describe incompatible musical directions.

Handling conflicting controls

  1. Detect the conflict

    Compare tempo, duration, harmony, instrumentation, and style instructions before generation.

  2. Decide which control has priority

    A workflow may treat a supplied melody or chord sequence as stricter than descriptive text.

  3. Rewrite vague text

    Remove words that conflict with explicit numerical or symbolic controls.

  4. Generate and evaluate

    Check each requested attribute separately rather than judging only overall audio quality.

  5. Revise one condition at a time

    Changing several controls together makes it harder to identify the source of failure.

Adjusting control strength

Diffusion and related models can use classifier-free guidance to strengthen a condition during generation.

The system compares a conditional prediction with an unconditional prediction and combines them. A larger guidance scale can increase prompt adherence, but it may reduce diversity or introduce artifacts.

MusicGen-Style extends this idea with separate text and audio conditions so their influence can be balanced.

Generation and editing

Conditioning is not limited to creating music from an empty starting point. Existing audio can become part of the condition.

A model can continue a recording, extend it before or after the known segment, replace a selected region, or create variations while preserving parts of the original.

These tasks differ mainly in which parts of the representation are fixed and which parts the model is allowed to generate.

Generation and editing tasks

Swipe sideways to view the full comparison

TaskWhat remains fixedWhat the model creates
Generation from scratchPrompt or other conditionsThe full musical result
ContinuationAn opening prefixMusic after the known prefix
OutpaintingA known region near an edgeNew material before or after it
InpaintingAudio before and after a missing regionA replacement for the selected middle region
VariationSelected musical identity or source materialA modified alternative
Loop extensionA loop or repeated contextA longer sequence that preserves loop compatibility

Continuation

A continuation model treats the existing opening as context. The generated material should connect naturally with its rhythm, harmony, timbre, and production.

In an autoregressive model, the prompt tokens become the initial prefix. In a masked-token model, the known prefix remains visible while later positions are generated.

Continuation becomes harder when the supplied audio ends during an unstable chord, phrase, or transition.

Continuation and inpainting

Swipe sideways to view the full comparison

QuestionContinuationInpainting
Known contextUsually appears before the generated regionUsually appears on both sides of the generated region
Main goalCreate a plausible futureCreate a bridge that fits the surrounding audio
Model attentionCan use left-to-right contextBenefits from bidirectional context
ExampleExtend an eight-bar loopReplace a weak transition between two sections

In practice

Real-world example: VampNet

VampNet uses masked acoustic-token modelling rather than left-to-right generation. Different masking patterns let the same model perform synthesis, compression, continuation, inpainting, outpainting, and looping with variation.

Evaluating control

A sample can sound good while ignoring the requested condition. It can also follow the chord sequence accurately while sounding unnatural.

Control evaluation should therefore separate:

    1. Overall audio quality
    2. Adherence to the text
    3. Melody similarity
    4. Chord accuracy
    5. Tempo accuracy
    6. Lyric intelligibility
    7. Duration accuracy
    8. Boundary quality for edits
    9. Similarity to a reference
    10. Difference from the reference

The last two can conflict. A style-conditioned output should resemble the reference in useful ways without simply reproducing it.

Why a control may fail

Swipe sideways to view the full comparison

CauseExamplePossible response
Weak training labelsTempo or instrument names are missing or inconsistentImprove the dataset and annotation process
Representation loses informationA melody feature removes rhythm or octaveUse a representation that preserves the required detail
Conflicting controlsText requests slow ambience while drums specify a fast grooveSet priorities or revise the conditions
Condition is out of distributionThe model receives an unusual chord sequence it rarely sawReduce the constraint or use specialised training
Control is too strongGuidance produces artifacts or low variationReduce the guidance or condition weight
Control is too weakThe model ignores the supplied melodyIncrease control strength or use a more direct representation

Interactive lesson

Mix Conditioning Signals

Try it: Begin with text only. Add one control at a time and inspect which musical attributes become more constrained. Introduce a conflicting tempo or chord condition, resolve the warning, and then switch between generation, continuation, and inpainting modes.

Conditioning gives the model information it should follow. Global conditions describe the overall result, while local conditions change across time. Continuation generates after a known prefix, while inpainting replaces a selected region using context from both sides.

Control becomes harder as the song grows

A model may follow a prompt, melody, and chord sequence for a short clip while losing direction over several minutes. The longer the output becomes, the more the system must manage repetition, development, transitions, memory, and ending structure.

The next section, Why Long Songs Are Difficult, explains why extending duration creates a different problem from generating a convincing short passage.

Check your understanding

Ready for a quick check?

Test whether you can distinguish conditioning types, control scopes, editing tasks, and real controllable music systems.

Ready to continue?

Save this section to your account and continue from any device.

Checking your account…
Sources for this lesson (15)
  1. Simple and Controllable Music Generation — Jade Copet et al. (2023)
  2. MusicGen: Simple and Controllable Music Generation — Meta AI
  3. MusicLM: Generating Music From Text — Andrea Agostinelli et al. (2023)
  4. Joint Audio and Symbolic Conditioning for Temporally Controlled Text-to-Music Generation — Or Tal, Alon Ziv, Itai Gat, Felix Kreuk, and Yossi Adi (2024)
  5. JASCO: Joint Audio and Symbolic Conditioning — Meta AI (2024)
  6. Mustango: Toward Controllable Text-to-Music Generation — Jan Melechovsky et al. (2023)
  7. MuseCoco: Generating Symbolic Music from Text — Peiling Lu et al. (2023)
  8. Fast Timing-Conditioned Latent Audio Diffusion — Zach Evans, CJ Carr, Josiah Taylor, Scott H. Hawley, and Jordi Pons (2024)
  9. Jukebox: A Generative Model for Music — Prafulla Dhariwal et al. (2020)
  10. VampNet: Music Generation via Masked Acoustic Token Modeling — Hugo Flores Garcia, Prem Seetharaman, Rithesh Kumar, and Bryan Pardo (2023)
  11. VampNet: Music Generation via Masked Acoustic Token Modeling — Interactive Audio Lab (2023)
  12. Audio Conditioning for Music Generation via Discrete Bottleneck Features — Simon Rouard, Yossi Adi, Jade Copet, Axel Roebel, and Alexandre Défossez (2024)
  13. MusicGen-Style — Meta AI (2024)
  14. Classifier-Free Diffusion Guidance — Jonathan Ho and Tim Salimans (2022)
  15. AudioLDM: Text-to-Audio Generation with Latent Diffusion Models — Haohe Liu et al. (2023)
Browse all contextual sources →