# Short endpoint: /stream
# - Up to 1000 characters
# - Synchronous, instant response (0.3s+)
# - Streams back raw audio data
import requests
response = requests.post(
'https://api.v7.unrealspeech.com/stream',
headers = {
'Authorization' : 'Bearer YOUR_API_KEY'
},
json = {
'Text': '''<YOUR_TEXT>''', # Up to 1000 characters
'VoiceId': '<VOICE_ID>', # Dan, Will, Scarlett, Liv, Amy
'Bitrate': '128k', # 320k, 256k, 192k, ...
'Speed': '0', # -1.0 to 1.0
'Pitch': '1', # -0.5 to 1.5
'Codec': 'libmp3lame', # libmp3lame or pcm_mulaw
}
)
with open('audio.mp3', 'wb') as f:
f.write(response.content)
# Long endpoint: /synthesisTasks
# - Up to 500,000 characters
# - Asynchronous, takes ~1s per 800 chars
# - Returns a TaskId (use to check status)
import requests
response = requests.post(
'https://api.v7.unrealspeech.com/synthesisTasks',
headers = {
'Authorization' : 'Bearer YOUR_API_KEY'
},
json = {
'Text': '''<YOUR_TEXT>''', # Up to 500,000 characters
'VoiceId': '<VOICE_ID>', # Dan, Will, Scarlett, Liv, Amy
'Bitrate': '128k', # 320k, 256k, 192k, ...
'Speed': '0', # -1.0 to 1.0
'Pitch': '1', # -0.5 to 1.5
'TimestampType': 'sentence', # word or sentence
#'CallbackUrl': '<URL>', # pinged when ready
}
)
print(response.json())
{
'SynthesisTask': {
'CreationTime': '2023-09-01T15:05:22.15Z',
'OutputUri': 'https://unreal-tts-live-demo.s3-us-west-1.amazonaws.com/d8ef514d.mp3',
'RequestCharacters': 14,
'TaskId': 'd8ef514d',
'TaskStatus': 'scheduled',
'TimestampsUri': 'https://unreal-tts-live-demo.s3-us-west-1.amazonaws.com/d8ef514d.json',
'VoiceId': 'Scarlett'
}
}
import requests
response = requests.get(
'https://api.v7.unrealspeech.com/synthesisTasks/d8ef514d',
headers = {
'Authorization' : 'Bearer YOUR_API_KEY'
},
json = {}
)
print(response.json())
// Short endpoint: /stream
// - Up to 1000 characters
// - Synchronous, instant response (0.3s+)
// - Streams back raw audio data
const axios = require('axios');
const fs = require('fs');
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
};
const data = {
'Text': '<YOUR_TEXT>', // Up to 1000 characters
'VoiceId': '<VOICE_ID>', // Dan, Will, Scarlett, Liv, Amy
'Bitrate': '128k', // 320k, 256k, 192k, ...
'Speed': '0', // -1.0 to 1.0
'Pitch': '1', // -0.5 to 1.5
'Codec': 'libmp3lame', // libmp3lame or pcm_mulaw
};
axios({
method: 'post',
url: 'https://api.v7.unrealspeech.com/stream',
headers: headers,
data: data,
responseType: 'stream'
}).then(function (response) {
response.data.pipe(fs.createWriteStream('audio.mp3'))
});
// Long endpoint: /synthesisTasks
// - Up to 500,000 characters
// - Asynchronous, takes ~1s per 800 chars
// - Returns a TaskId (use to check status)
const axios = require('axios');
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
};
const data = {
'Text': '<YOUR_TEXT>', // Up to 500,000 characters
'VoiceId': '<VOICE_ID>', // Dan, Will, Scarlett, Liv, Amy
'Bitrate': '128k', // 320k, 256k, 192k, ...
'Speed': '0', // -1.0 to 1.0
'Pitch': '1', // -0.5 to 1.5
'TimestampType': 'sentence', // word or sentence
//'CallbackUrl': '<URL>', // pinged when ready
};
axios({
method: 'post',
url: 'https://api.v7.unrealspeech.com/synthesisTasks',
headers: headers,
data: data,
}).then(function (response) {
console.log(JSON.stringify(response.data));
});
{
'SynthesisTask': {
'CreationTime': '2023-09-01T15:05:22.15Z',
'OutputUri': 'https://unreal-tts-live-demo.s3-us-west-1.amazonaws.com/d8ef514d.mp3',
'RequestCharacters': 14,
'TaskId': 'd8ef514d',
'TaskStatus': 'scheduled',
'TimestampsUri': 'https://unreal-tts-live-demo.s3-us-west-1.amazonaws.com/d8ef514d.json',
'VoiceId': 'Scarlett'
}
}
const axios = require('axios');
const headers = {
'Authorization': 'Bearer YOUR_API_KEY',
};
axios({
method: 'get',
url: 'https://api.v7.unrealspeech.com/synthesisTasks/d8ef514d',
headers: headers,
}).then(function (response) {
console.log(JSON.stringify(response.data));
});
# Short endpoint: /stream
# - Up to 1000 characters
# - Synchronous, instant response (0.3s+)
# - Streams back raw audio data
curl -X POST "https://api.v7.unrealspeech.com/stream" -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY" --data '{"Text": "<YOUR_TEXT>", "VoiceId": "<VOICE_ID>", "Bitrate": "128k", "Speed": "0", "Pitch": "1", "Codec": "libmp3lame"}' --output audio.mp3
# Long endpoint: /synthesisTasks
# - Up to 500,000 characters
# - Asynchronous, takes ~1s per 800 chars
# - Returns a TaskId (use to check status)
curl -X POST "https://api.v7.unrealspeech.com/synthesisTasks" -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY" --data '{"Text": "<YOUR_TEXT>", "VoiceId": "<VOICE_ID>", "Bitrate": "128k", "Speed": "0", "Pitch": "1", "TimestampType": "sentence"}'
{
'SynthesisTask': {
'CreationTime': '2023-09-01T15:05:22.15Z',
'OutputUri': 'https://unreal-tts-live-demo.s3-us-west-1.amazonaws.com/d8ef514d.mp3',
'RequestCharacters': 14,
'TaskId': 'd8ef514d',
'TaskStatus': 'scheduled',
'TimestampsUri': 'https://unreal-tts-live-demo.s3-us-west-1.amazonaws.com/d8ef514d.json',
'VoiceId': 'Scarlett'
}
}
curl -X GET "https://api.v7.unrealspeech.com/synthesisTasks/d8ef514d" -H "Content-Type: application/json" -H "Authorization: Bearer YOUR_API_KEY"