Composition plans
Composition plans provide fine-grained control over music generation, defining global styles, individual sections with local styles, and lyrics placement. Use text prompts for quick prototyping and composition plans when you need specific section structure, precise lyrics timing, or complex arrangements.
Composition plans and text prompts are mutually exclusive. Use one or the other, not both.
Quickstart
Follow the music quickstart to set up your API key and install the SDK, then use composition plans for more control.
Structure reference
Global styles
Apply to the entire song:
- positive_global_styles: Genres (
"pop","rock"), instruments ("acoustic guitar","piano"), mood ("upbeat","melancholic"), vocals ("male vocals","female vocals"), technical specs ("120 BPM","A minor") - negative_global_styles: What to avoid (
"dark","aggressive","electronic beats")
Sections
A song can have up to 30 sections. Total duration must be between 3 seconds and 10 minutes, with each section between 3 and 120 seconds.
Section duration behavior
By default, the model strictly follows the duration_ms values in your composition plan. Set respect_sections_durations to false for better audio quality at the cost of less precise timing:
When set to false, the model still follows your section structure but adjusts timing for more natural transitions. For precise control over section boundaries, keep the default true.
Writing lyrics
The lines field must contain only singable or speakable content. Performance directions, vocal styles, and stage directions go in positive_local_styles, not in lyrics.
Phonetic sounds are acceptable in lyrics: "(hmmm hmmm)", "(ooh)", "(yeah)".
For multiple vocalists, use separate sections with different positive_local_styles rather than annotations in lyrics.
Style tips
Be specific with style descriptors:
Use negative styles liberally to prevent unwanted sounds. Styles must be in English (lyrics can be any language).
If you include copyrighted content in styles, the API returns a bad_composition_plan error with a suggested alternative. See handling copyrighted material.