Generate Sound Based on Given Prompt
curl --request POST \
--url https://api.musicgpt.com/api/public/v1/sound_generator \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'prompt=Generate a soothing ambient soundscape.' \
--data generate_album_cover=false \
--data webhook_url=http://your-webhook-url.com/callback \
--data audio_length=30import requests
url = "https://api.musicgpt.com/api/public/v1/sound_generator"
payload = {
"prompt": "Generate a soothing ambient soundscape.",
"generate_album_cover": "false",
"webhook_url": "http://your-webhook-url.com/callback",
"audio_length": "30"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
prompt: 'Generate a soothing ambient soundscape.',
generate_album_cover: 'false',
webhook_url: 'http://your-webhook-url.com/callback',
audio_length: '30'
})
};
fetch('https://api.musicgpt.com/api/public/v1/sound_generator', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.musicgpt.com/api/public/v1/sound_generator",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.musicgpt.com/api/public/v1/sound_generator"
payload := strings.NewReader("prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.musicgpt.com/api/public/v1/sound_generator")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/sound_generator")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "0af8567f-6156-4bb2-9adc-99b0c8792700",
"conversion_id": "9e6ac90d-c09e-4ea6-8c39-d9f4e39bbbc8",
"eta": 84,
"credit_estimate": 0.99,
"message": "",
"status": "IN_QUEUE"
}{
"success": false,
"error": "Prompt is required for sound generation."
}{
"success": false,
"error": "Internal Server Error"
}Features
Sound Generator
Creates an audio file based on a textual prompt. The generation process is asynchronous and returns a task ID for tracking.
POST
/
v1
/
sound_generator
Generate Sound Based on Given Prompt
curl --request POST \
--url https://api.musicgpt.com/api/public/v1/sound_generator \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data 'prompt=Generate a soothing ambient soundscape.' \
--data generate_album_cover=false \
--data webhook_url=http://your-webhook-url.com/callback \
--data audio_length=30import requests
url = "https://api.musicgpt.com/api/public/v1/sound_generator"
payload = {
"prompt": "Generate a soothing ambient soundscape.",
"generate_album_cover": "false",
"webhook_url": "http://your-webhook-url.com/callback",
"audio_length": "30"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Authorization: '<api-key>',
'Content-Type': 'application/x-www-form-urlencoded'
},
body: new URLSearchParams({
prompt: 'Generate a soothing ambient soundscape.',
generate_album_cover: 'false',
webhook_url: 'http://your-webhook-url.com/callback',
audio_length: '30'
})
};
fetch('https://api.musicgpt.com/api/public/v1/sound_generator', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.musicgpt.com/api/public/v1/sound_generator",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/x-www-form-urlencoded"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.musicgpt.com/api/public/v1/sound_generator"
payload := strings.NewReader("prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.musicgpt.com/api/public/v1/sound_generator")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/x-www-form-urlencoded")
.body("prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.musicgpt.com/api/public/v1/sound_generator")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/x-www-form-urlencoded'
request.body = "prompt=Generate%20a%20soothing%20ambient%20soundscape.&generate_album_cover=false&webhook_url=http%3A%2F%2Fyour-webhook-url.com%2Fcallback&audio_length=30"
response = http.request(request)
puts response.read_body{
"success": true,
"task_id": "0af8567f-6156-4bb2-9adc-99b0c8792700",
"conversion_id": "9e6ac90d-c09e-4ea6-8c39-d9f4e39bbbc8",
"eta": 84,
"credit_estimate": 0.99,
"message": "",
"status": "IN_QUEUE"
}{
"success": false,
"error": "Prompt is required for sound generation."
}{
"success": false,
"error": "Internal Server Error"
}Create custom sounds with AI using just a simple prompt.
Sound Generator lets you synthesize high-quality sound effects and audio textures directly from text prompts. Perfect for developers, game designers, filmmakers, and creative technologists who need original sounds on demand.
Use this endpoint to generate sounds based on a text description.
- Generate realistic or abstract sounds
- Fine-tuned AI audio creation
- Instant feedback or asynchronous delivery via webhook
Endpoint
POST /v1/sound_generator
Sample Output
Listen to an actual sample: Prompt: sound of waves crashing at the sea shore. Download AudioTry it Yourself
Visit the Sound Generator Endpoint Explorer to try live prompt-based sound creation.🚀 Experiment with different descriptions — from realistic sounds (like “city street at night”) to fantastical ones (“alien spacecraft landing”)!
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | String | Yes | A natural language description of the sound you want |
webhook_url | String | Optional | Webhook URL to receive a callback with the audio result |
audio_length | int | Optional | Specify song length |
generate_album_cover | Boolean | Optional | If true, generate an album cover for the generated audio |
content-type: application/x-www-form-urlencoded
Sample Request
Python
import requests
url = "https://api.musicgpt.com/api/public/v1/sound_generator"
payload = {
"prompt": "Generate a soothing ambient soundscape.",
"generate_album_cover": "false",
"webhook_url": "http://your-webhook-url.com/callback",
"audio_length": "30"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/x-www-form-urlencoded"
}
response = requests.post(url, data=payload, headers=headers)
print(response.text)
Sample Response
Success (200 OK)
{
"success":true,
"task_id":"0af8567f-6156-4bb2-9adc-99b0c8792700",
"conversion_id":"9e6ac90d-c09e-4ea6-8c39-d9f4e39bbbc8",
"eta":84,
"credit_estimate":0.99,
"message":"",
"status":"IN_QUEUE"
}
Webhook Response
Once the sound is ready, your webhook will receive:{
"success": true,
"conversion_type": "Sound Creator",
"task_id": "0af8567f-6156-4bb2-9adc-99b0c8792700",
"conversion_id": "9e6ac90d-c09e-4ea6-8c39-d9f4e39bbbc8",
"conversion_duration": 2.089795918367347,
"message": "Audio Generation Completed Successfully",
"conversion_paths": {"9e6ac90d-c09e-4ea6-8c39-d9f4e39bbbc8": "https://lalals.s3.amazonaws.com/conversions/0af8567f-6156-4bb2-9adc-99b0c8792700_sound.mp3"},
"conversion_durations": {"9e6ac90d-c09e-4ea6-8c39-d9f4e39bbbc8": 2.089795918367347}
}
Note: If your webhook is set, you’ll get the sound automatically once ready. Otherwise, you can fetch it manually using the conversion_id.
Payload and Request Formation
Authorizations
Body
application/x-www-form-urlencoded
Text prompt guiding the sound generation.
Example:
"Generate a soothing ambient soundscape."
Whether to generate an album cover for the generated audio
Callback URL for async processing results.
Example:
"http://your-webhook-url.com/callback"
Desired duration of generated audio in seconds (beta feature)
Example:
30