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
Condition
What it can guide
Typical representation
Text
Genre, mood, instrumentation, production, context, or intended use
Text embeddings
Melody
Pitch contour and melodic movement
Chromagram, MIDI, note events, or audio-derived features
Chords and harmony
Harmonic progression and local tonal context
Chord labels or time-aligned symbolic features
Rhythm and drums
Beat placement, rhythmic density, groove, or drum pattern
Beat sequence, symbolic rhythm, or separated drum audio
Tempo
Overall pace or beat rate
BPM value, tempo class, or text attribute
Lyrics
Words, vocal content, and sometimes phrase order
Text tokens with optional alignment
Duration and timing
Output length and position within a generated segment
Timing embeddings or duration values
Reference audio
Style, timbre, instrumentation, melody, or continuation context
Audio 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
Prompt
Information supplied
Likely limitation
Piano music
One broad instrument category
Tempo, mood, style, and production remain open
Slow intimate solo piano
Instrument, pace, arrangement, and mood
Harmony and exact melody remain open
Slow intimate solo piano in a spacious room, sparse notes, soft pedal noise
Instrument, pace, arrangement, environment, density, and production
The model may still interpret subjective words differently
Play this exact melody at 72 BPM using intimate solo piano
Text, melody, tempo, and instrumentation
Requires a model that supports every stated condition
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
Area
Symbolic representation
Audio representation
Pitch editing
Individual notes can be changed directly
Pitch is entangled with timbre and performance
Chord control
Chord labels can align with bars and note events
The model must render the harmony into realistic sound
Instrumentation
Instrument tracks can be assigned explicitly
Instrument identity is represented acoustically
Production detail
Usually limited
Can include room sound, distortion, texture, and mixing
Post-generation editing
Straightforward in MIDI or score form
Often 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:
A slow ambient texture
A drum pattern at 150 BPM
A gentle lullaby melody
Aggressive distorted production
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
Task
What remains fixed
What the model creates
Generation from scratch
Prompt or other conditions
The full musical result
Continuation
An opening prefix
Music after the known prefix
Outpainting
A known region near an edge
New material before or after it
Inpainting
Audio before and after a missing region
A replacement for the selected middle region
Variation
Selected musical identity or source material
A modified alternative
Loop extension
A loop or repeated context
A 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
Question
Continuation
Inpainting
Known context
Usually appears before the generated region
Usually appears on both sides of the generated region
Main goal
Create a plausible future
Create a bridge that fits the surrounding audio
Model attention
Can use left-to-right context
Benefits from bidirectional context
Example
Extend an eight-bar loop
Replace 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:
Overall audio quality
Adherence to the text
Melody similarity
Chord accuracy
Tempo accuracy
Lyric intelligibility
Duration accuracy
Boundary quality for edits
Similarity to a reference
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
Cause
Example
Possible response
Weak training labels
Tempo or instrument names are missing or inconsistent
Improve the dataset and annotation process
Representation loses information
A melody feature removes rhythm or octave
Use a representation that preserves the required detail
Conflicting controls
Text requests slow ambience while drums specify a fast groove
Set priorities or revise the conditions
Condition is out of distribution
The model receives an unusual chord sequence it rarely saw
Reduce the constraint or use specialised training
Control is too strong
Guidance produces artifacts or low variation
Reduce the guidance or condition weight
Control is too weak
The model ignores the supplied melody
Increase 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.