create.new_sample makes a short piece of music (a “sample”) from a description, at the length you ask for. Set loopable to make a clip that repeats seamlessly, end to start. Use it for loops in a music app, stings and idents, short backgrounds for video, or building blocks for your own tracks. Samples have no vocals.
For a full-length piece, use create.new_instrumental. For a sound rather than music (a whoosh, an impact, a door slam), use create.new_fx.
The request
Every field, with its exact rules: submit and poll in the API Reference.
Example
This makes an 8-second guitar loop and saves it. It uses the reference client; savesoundpiece.py or soundpiece.mjs next to it first.
The result
run returns the finished sample object:
Choosing parameters
- Prompt. Mix genre, mood and instruments, separated by commas. Say what you don’t want too, e.g.
"no drums", when the sample will be layered with other parts. - Duration. For a loop, choose a length that holds a whole number of bars at your tempo: at 120 BPM in 4/4, one bar is 2 seconds, so 8 seconds is four bars.
loopable. Turn it on when the clip will repeat, so the end flows back into the start without a click or a jump. Leave it off for a one-off sting or ident.- Loudness. This endpoint doesn’t take a
loudnessblock. To normalise a sample, pass its URL toadapt.normalise_loudness.
Errors
When you submit (the request is refused, nothing is charged):
While processing (the operation finishes as
failed, with an error.code):
This endpoint takes no source audio, so it has no source limits and none of the
source_* errors.
See Errors for the response shapes, and for the errors every endpoint can return (401, 403, 429).
