Audio Generator. Generate natural-sounding audio in multiple languages and voices.
Everything you need to integrate our TTS API
fetch('/api/voices')
.then(res => res.json())
.then(data => console.log(data)){
"responseCode": "200",
"voiceGroups": [
{
"language": "English",
"locale": "en-US",
"accent": "American",
"voices": [
{
"voiceId": "V0160199018703841W",
"voiceName": "Natasha",
"language": "English",
"voiceStyles": ["Conversational", "Narration"],
"gender": "Female"
}
]
}
]
}textThe text to convert to speech
voiceIdThe ID of the voice to use
styleVoice style (only for voices that support styles)
fetch('/api/generate-tts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: 'Hello, this is a test of the text-to-speech API.',
voiceId: 'V0160199018703841W',
style: 'Conversational'
})
})
.then(res => res.json())
.then(data => console.log(data.mp3Url)){
"success": true,
"mp3Url": "/temp/audio-1234567890-abc123.mp3"
}{
"success": false,
"error": "Text exceeds maximum length of 500 characters"
}Generated MP3 files are automatically deleted after 20 minutes. Make sure to download or process them within this timeframe.
// Step 1: Fetch available voices
const voicesResponse = await fetch('/api/voices')
const { voiceGroups } = await voicesResponse.json()
// Step 2: Select a voice
const firstVoice = voiceGroups[0].voices[0]
console.log('Using voice:', firstVoice.voiceName)
// Step 3: Generate audio
const ttsResponse = await fetch('/api/generate-tts', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
text: 'Welcome to our text-to-speech API!',
voiceId: firstVoice.voiceId,
style: firstVoice.voiceStyles[0] // Use first style if available
})
})
const { success, mp3Url, error } = await ttsResponse.json()
if (success) {
// Step 4: Use the audio
const audio = new Audio(mp3Url)
audio.play()
} else {
console.error('Error:', error)
}