Song Generator Endpoint
Overview
The Song Generator endpoint enables you to generate song by providing a lyrics along with a valid audio URL
Sample Generation
Example 1
Prompt
[00:10.00]Moonlight spills through broken blinds
[00:13.20]Your shadow dances on the dashboard shrine
[00:16.85]Neon ghosts in gasoline rain.
Generated Output
Request
--request POST 'https://modelslab.com/api/v6/voice/song_generator' \
Make a POST
request to https://modelslab.com/api/v6/voice/song_generator endpoint and pass the required parameters as a request body.
Body Attributes
Parameter | Description | Values |
---|---|---|
key | The API key used for authenticating your request. | String |
prompt | Lyrics in LRC format (timestamp + lyrics). The only supported language is English. | Text |
init_audio | URL to the reference audio file to influencestyle. | MP3/WAV URL |
webhook | A URL where the API will send a POST request once the audio generation is complete. | URL |
track_id | An ID returned in the API response, used to identify webhook requests | Integral value |
Example
Body
Body
{
"key": "",
"prompt":"Narrative voices capable of pronouncing terminologies & acronyms in training and ai learning materials.",
"init_audio":"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav",
"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":"[00:10.00]Moonlight spills through broken blinds [00:13.20]Your shadow dances on the dashboard shrine [00:16.85]Neon ghosts in gasoline rain",
"init_audio":"https://storage.googleapis.com/falserverless/model_tests/diffrythm/rock_en.wav",
"webhook": null,
"track_id": null
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://modelslab.com/api/v6/voice/song_generator", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
<?php
$payload = [
"key" => "",
"prompt" => "[00:10.00]Moonlight spills through broken blinds [00:13.20]Your shadow dances on the dashboard shrine [00:16.85]Neon ghosts in gasoline rain",
"init_audio" => "https://storage.googleapis.com/falserverless/model_tests/diffrythm/rock_en.wav",
"webhook" => null,
"track_id" => null
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://modelslab.com/api/v6/voice/song_generator',
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/v6/voice/song_generator',
'headers': {
'Content-Type': 'application/json'
},
body: JSON.stringify({
"key": "",
"prompt":"[00:10.00]Moonlight spills through broken blinds [00:13.20]Your shadow dances on the dashboard shrine [00:16.85]Neon ghosts in gasoline rain",
"init_audio":"https://storage.googleapis.com/falserverless/model_tests/diffrythm/rock_en.wav",
"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/v6/voice/song_generator"
payload = json.dumps({
"key": "",
"prompt":"[00:10.00]Moonlight spills through broken blinds [00:13.20]Your shadow dances on the dashboard shrine [00:16.85]Neon ghosts in gasoline rain",
"init_audio":"https://storage.googleapis.com/falserverless/model_tests/diffrythm/rock_en.wav",
"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\":\"[00:10.00]Moonlight spills through broken blinds [00:13.20]Your shadow dances on the dashboard shrine [00:16.85]Neon ghosts in gasoline rain.\",\n \"init_audio\":\"https://pub-f3505056e06f40d6990886c8e14102b2.r2.dev/audio/tom_hanks_1.wav\",\n }");
Request request = new Request.Builder()
.url("https://modelslab.com/api/v6/voice/song_generator")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.build();
Response response = client.newCall(request).execute();
Response
{
"status": "success",
"generationTime": 1.904285192489624,
"id": 334166,
"output": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/a3f8a04c-26c1-485c-b3b5-5c6244a0d395.wav"
],
"proxy_links": [
"https://pub-3626123a908346a7a8be8d9295f44e26.r2.dev/generations/a3f8a04c-26c1-485c-b3b5-5c6244a0d395.wav"
],
"meta": {
"lrc": "[00:10.00]Moonlight spills through broken blinds [00:13.20]Your shadow dances on the dashboard shrine [00:16.85]Neon ghosts in gasoline rain",
"ref_audio_path": "tmp/rock_en.wav",
"text_prompt": null,
"prompt_type": "audio",
"seed": 42,
"randomize_seed": false,
"steps": 32,
"cfg_strength": 4,
"file_type": "wav",
"odeint_method": "euler",
"music_duration": "95s",
"device": "cuda",
"webhook": null,
"id": null,
"filename": "a3f8a04c-26c1-485c-b3b5-5c6244a0d395",
"temp": "no",
"track_id": null,
"base64": "no"
}
}