Engage Users with an Easy to Use Text to Speech API
Integrate real-time voice synthesis in your devices and applications with our easy-to-use Generative AI Text to Speech API. Create delightful user experiences in real-time with our ultra-realistic Voice AI models.
const options = {
method: 'POST',
headers: {
AUTHORIZATION: '<api-key>',
'X-USER-ID': '<api-key>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'PlayDialog',
text: `Country Mouse: Welcome to my humble home, cousin!
Town Mouse: Thank you, cousin. It's quite... peaceful here.
Country Mouse: It is indeed. I hope you're hungry.
I've prepared a simple meal of beans, barley, and fresh roots.
Town Mouse: Well, it's... earthy. Do you eat this every day?`,
voice: 's3://voice-cloning-zero-shot/baf1ef41-36b6-428c-9bdf-50ba54682bd8/original/manifest.json',
voice2: 's3://voice-cloning-zero-shot/baf1ef41-36b6-428c-9bdf-50ba54682bd8/original/manifest.json',
outputFormat: 'mp3',
speed: 1,
sampleRate: 44100,
seed: null,
temperature: null,
turnPrefix: 'Country Mouse:',
turnPrefix2: 'Town Mouse:',
prompt: '<string>',
prompt2: '<string>',
voiceConditioningSeconds: 20,
voiceConditioningSeconds2: 20,
language: 'english',
webHookUrl: '<string>',
}),
};
fetch('https://api.play.ai/api/v1/tts', options)
.then(response => response.json())
.then(response => console.log(response))
.catch(err => console.error(err));





