Overview
The Music Generation API allows you to create original music tracks from text prompts. Generate instrumental or vocal music in various styles, lengths, and genres.Basic Music Generation
Generate music from a simple prompt:Detailed Response
Get detailed metadata along with the audio:Parameters
string
Text description of the music to generate.
MusicPrompt
Detailed composition plan instead of a text prompt.
integer
Length of the music in milliseconds.
string
Model to use for generation. Default:
music_v1.string
Output audio format (e.g.,
mp3_44100_128).boolean
Force the generation to be instrumental only (no vocals).
boolean
Store the generation for future inpainting/editing.
boolean
Include timestamps in the response.
boolean
Sign the audio with C2PA authentication.
Instrumental Music
Generate instrumental-only music:Different Music Lengths
Generate music of various durations:With Composition Plan
Use a structured composition plan for more control:Store for Later Editing
Generate and store music for future inpainting:Different Genres and Styles
Batch Generation
Generate multiple tracks:Async Generation
Generate music asynchronously:Parallel Generation
Generate multiple tracks concurrently:Output Formats
Supported output formats:mp3_22050_32- MP3 at 22.05kHz, 32kbpsmp3_44100_32- MP3 at 44.1kHz, 32kbpsmp3_44100_64- MP3 at 44.1kHz, 64kbpsmp3_44100_96- MP3 at 44.1kHz, 96kbpsmp3_44100_128- MP3 at 44.1kHz, 128kbps (recommended)mp3_44100_192- MP3 at 44.1kHz, 192kbps
Use Cases
Content Creation
Generate background music for videos
Game Development
Create dynamic game soundtracks
Podcasts
Add intro/outro music to episodes
Marketing
Create custom audio for campaigns
Best Practices
Music generation is non-deterministic. The same prompt may produce different results each time. For consistent results, save the song_id when using
store_for_inpainting.Prompt Tips
Write effective music generation prompts:Error Handling
Related Features
- Text to Speech - Generate speech
- Sound Effects - Generate sound effects (if available)
- Audio Isolation - Clean generated audio