SFX Endpoint
Overview
The sfx endpoint allows you to generate sound effects (SFX) using the stable-audio-open model. It takes user input in the form of a text prompt to conditionally generate audio effects.
Request
--request POST 'https://modelslab.com/api/v1/enterprise/voice/sfx' \
Make a POST
request to https://modelslab.com/api/v1/enterprise/voice/sfx endpoint and pass the required parameters as a request body.
caution
Make sure you add your s3 details for voice_cloning
server, so you can receive image generated in your bucket.
Images generated without s3 details being added will be delete after 24 hours
Body Attributes
Parameter | Description | Values |
---|---|---|
key | Your API Key used for request authorization | string |
prompt | A descriptive prompt that conditions the audio generation, specifying the type of sound effect desired. | string |
Example
Body
Body
{
"key":"",
"prompt":"Thunderstorm with rain",
"temp": false,
"webhook": null,
"track_id": null
}
Request
- JS
- PHP
- NODE
- PYTHON
- JAVA
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
var raw = JSON.stringify({
"key":"",
"prompt":"Thunderstorm with rain",
"temp": false,
"webhook": null,
"track_id": null
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://modelslab.com/api/v1/enterprise/voice/sfx", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"prompt" => "Thunderstorm with rain",
"temp" => false,
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v1/enterprise/voice/sfx',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($payload),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var request = require('request');
var options = {
'method': 'POST',
'url': 'https://modelslab.com/api/v1/enterprise/voice/sfx',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key":"",
"prompt":"Thunderstorm with rain",
"temp": false,
"webhook": null,
"track_id": null
})
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
import requests
import json
url = "https://modelslab.com/api/v1/enterprise/voice/sfx"
payload = json.dumps({
"key":"",
"prompt":"Thunderstorm with rain",
"temp": False,
"webhook": None,
"track_id":None
})
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"key\":\"\",\n \"prompt\":\"Thunderstorm with rain\",\n \"webhook\":\"\",\n \"track_id\":\"\"\n}");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v1/enterprise/voice/sfx")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
{
{
"eta": 5,
"fileId": "8b8f9044-bb13-4d2c-bc42-db427caf182d.wav",
"links": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/8b8f9044-bb13-4d2c-bc42-db427caf182d.wav"
],
"message": "Request has been queued",
"meta": {
"filename": "8b8f9044-bb13-4d2c-bc42-db427caf182d.wav",
"prompt": "man laughing",
"temp": "no"
},
"proxy_links": [
"https://cdn2.stablediffusionapi.com/generations/8b8f9044-bb13-4d2c-bc42-db427caf182d.wav"
],
"seconds": null,
"status": "queued",
"taskId": "a3525188-a894-47ea-9946-1e5a8f2c4abb"
}
}