ElevenLabs TTS API: Turn Book Text Into Audio
In this article
Yes, you can turn book text into audio with the ElevenLabs TTS API. The API accepts plain text or SSML input and returns high-quality, natural-sounding speech in over 30 languages, making it a practical tool for authors, publishers, and developers who want to create audiobooks or other spoken content programmatically.
Background: ElevenLabs and Text-to-Speech
ElevenLabs is an AI audio research company known for its realistic text-to-speech (TTS) models. Unlike older TTS systems that sounded robotic, ElevenLabs uses deep learning to generate speech with natural intonation, pacing, and emotion. The company launched its API in 2023, and it quickly became popular for voiceover work, accessibility tools, and audiobook production.
For book-length content, the API is especially useful because it can handle long passages without breaking the flow. It also supports custom voice cloning, which means you can create a consistent narrator voice for an entire book series.
How the ElevenLabs TTS API Works
The API is REST-based: you send a POST request with your text and voice settings, and it returns an audio file (MP3, WAV, or PCM). Here is a simple example using Python and the requests library:
import requests
url = "https://api.elevenlabs.io/v1/text-to-speech/{voice_id}"
headers = {
"xi-api-key": "YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"text": "Chapter One. It was a dark and stormy night...",
"model_id": "eleven_multilingual_v2",
"voice_settings": {
"stability": 0.5,
"similarity_boost": 0.75
}
}
response = requests.post(url, headers=headers, json=data)
with open("chapter1.mp3", "wb") as f:
f.write(response.content)You need a valid voice_id, which you can get from the Voices endpoint. The API also supports SSML for fine-grained control over pauses, emphasis, and pronunciation.
Choosing a Voice and Model
ElevenLabs offers a variety of pre-made voices and the ability to create custom voices. When converting a book, consider the genre and tone:
- Narrative non-fiction: a calm, clear voice with moderate stability.
- Fiction with dialogue: you may want a voice that can handle multiple characters, or you can generate separate audio for each character and stitch them together.
- Children's books: a warmer, more expressive voice.
The two main models are eleven_monolingual_v1 (English only) and eleven_multilingual_v2 (supports 30+ languages). For most book projects, the multilingual model is a safe choice because it handles names and foreign phrases better.
Step-by-Step: Converting a Book
- Extract the text from your manuscript (e.g., from DOCX, PDF, or EPUB) and clean it up: remove page numbers, headers, and footnotes.
- Split the text into manageable chunks. The API has a limit of 5,000 characters per request (or 10,000 with the Pro plan). Keep paragraphs intact to preserve natural pauses.
- Choose your voice and model. Test a few sentences first to ensure the pronunciation and tone are right.
- Send each chunk to the API and save the returned audio files.
- Combine the audio files using a tool like FFmpeg or a DAW. Add intro/outro music if desired.
- Review the final audio for errors. You can regenerate specific sentences by using the API's
textparameter with just that sentence.
This process can be automated with a script that reads a text file, splits it, and calls the API in a loop.
Costs and Limits
ElevenLabs has a free tier that gives you 10,000 credits per month (roughly 10 minutes of audio). Paid plans start at around $5 per month for 30,000 credits. A typical 10-hour audiobook would require about 600,000 credits, which would cost several hundred dollars on the Creator plan. It is more cost-effective for shorter works or for creating a sample chapter.
There is also a character limit per request, so you must chunk your text. The API supports up to 5,000 characters per request on the free tier and 10,000 on paid tiers.
Common Issues and Solutions
- Mispronounced names: Use the
pronunciation_dictionaryfeature or add phonetic spellings in SSML. - Too fast or too slow: Adjust the
speedparameter (0.5 to 2.0) in the request. - Inconsistent voice between chunks: Set the same
stabilityandsimilarity_boostfor every request, and use the same voice ID. - Long pauses between sentences: Use SSML to add
<break time="500ms"/>where needed. - API errors (401, 422): Check your API key and that the text is not empty.
Alternatives to the ElevenLabs API
Other TTS APIs include Amazon Polly, Google Cloud Text-to-Speech, and Microsoft Azure Speech. They are generally cheaper but often sound less natural. For high-quality narration, ElevenLabs is a leading choice, but you can also use open-source models like Coqui TTS if you have the hardware to run them locally.
If you are not a developer, you can use ElevenLabs' web interface to paste text and download audio, but the API is necessary for automating a full book.
Frequently Asked Questions
Can I use ElevenLabs to create an audiobook for commercial use?
Yes, ElevenLabs' terms allow commercial use of generated audio, including for audiobooks. However, you must ensure you have the rights to the text you are converting. If you clone a voice, you need permission from the voice owner.
How long does it take to convert a full book?
Processing time depends on the length of the text and the API load. A typical 300-page book (about 90,000 words) would take several hours of API calls, but the actual audio generation is fast—usually a few seconds per chunk. The bottleneck is splitting and uploading the text.
Can I use my own voice for narration?
Yes, you can create a custom voice by uploading samples of your voice (at least 30 minutes of clean audio). The API then uses that voice for all generations. This is useful for authors who want to narrate their own book but need to correct mistakes without re-recording.
What is the maximum text length per request?
The free tier supports up to 5,000 characters per request. Paid plans allow up to 10,000 characters. For longer text, you must split it into multiple requests and combine the audio files.
Does ElevenLabs support languages other than English?
Yes, the multilingual model supports over 30 languages, including Spanish, French, German, Chinese, and Hindi. The quality is generally high, but for less common languages, you may need to adjust pronunciation manually.
Can I add background music to the generated audio?
The API only generates speech. You would need to add music using audio editing software like Audacity or FFmpeg. Some users combine the speech with a separate music track during post-production.