Inpaint
This endpoint allows users to replace a specific time segment of an audio clip using a textual prompt and optional lyrics. The inpainting operation blends new audio content into the selected range, guided by user-defined style and voice preferences.
To use the inpaint feature, upload a song and specify the lyrics you want to replace in the field βlyrics_section_to_replaceβ. For best results, also provide the complete song lyrics in the lyrics.
Endpoint
Request Parameters
| Parameter | Type | Required | Description | |
|---|---|---|---|---|
audio_file | UploadFile | Optional | Upload the input audio file. Required if audio_url is not provided. | |
audio_url | String | Optional | Public/S3/YouTube URL of the input audio. Required if audio_file is not provided. | |
prompt | String | Required | Prompt describing how the replacement should sound. Example: βReplace this part with an opera-style vocal.β | |
replace_start_at | Float | Required | Start time (in seconds) of the segment to replace. | |
replace_end_at | Float | Required | End time (in seconds) of the segment to replace. | |
lyrics | String | Optional | Original lyrics of song. | |
lyrics_section_to_replace | String | Optional | Lyrics to be used for the replaced portion(optional, max 3000 characters) | |
gender | String | Optional | Voice style for vocal generation. One of: male, female, neutral. | |
num_outputs | int | Optional | The number of outputs to generate (1 or 2 only default : 1). | |
webhook_url | String | Optional | Callback URL for async response. |
π‘ Note: You must provide eitheraudio_fileoraudio_urlβ at least one is required.
content-type: multipart/form-data
Sample Output
Listen to a real output: Prompt: inpaint from 60 to 120 seconds in classical slow vibe - audio input : Moana How Far We will Go. Download AudioTry it Yourself
Visit the Inpaint Endpoint Explorer to test the endpoint β set your payload, hit send, and view the generated results.Sample Request
cURL
Python
π Replace{path_to_your_audio_file},api_key, andwebhook_urlbefore executing.
Sample Response
Success (200 OK)
Webhook Delivery
Once the generation is complete, webhooks will be triggered to deliver the following:Standard Requests (non-instrumental):
- 2 (webhooks) x Inpaint conversion details (one per version)
- 2 (webhooks) x Lyrics with timestamp data
- 1 Album Cover Image
Webhook responses include detailed metadata including task_id, conversion_id, audio files (conversion_path), lyrics etc.
Common Errors
- 422 Unprocessable Entity: Missing required fields like
prompt,replace_start_at, orreplace_end_at, or neitheraudio_filenoraudio_urlprovided. - 500 Internal Server Error: An unexpected error occurred during processing.
The response provides a downloadable or streamable inpainted audio file.
Payload and Request Formation
Authorizations
Body
- Option 1
- Option 2
URL or S3 path to the input audio.
"https://mybucket.s3.amazonaws.com/song.mp3"
A description of how the replacement should sound.
"Replace this part with an opera-style vocal."
Time in seconds to start replacing audio.
12.5
Time in seconds to stop replacing audio.
20
Uploaded input audio file.
Lyrics to be used for inpainting.
"This is where my story begins"
Lyrics to be used for the replaced portion(optional, max 3000 characters)
2000Voice style for the inpainted segment.
male, female, neutral "male"
The number of outputs to generate (1 or 2 only):default is 2.
Callback URL for async processing results.
"https://example.com/webhook"