Bakbak TTS best practices
Follow these best practices to get the most out of Bakbak TTS API.
Text Input and Script
Hindi: use Devanagari, not Roman
Hindi (hi) must be submitted in Devanagari script. Romanized or Latin transliteration (for example, namaste instead of नमस्ते) is not supported and will produce poor results.
English: Devanagari for Indic named entities
For English (en-in, en-us), Indic names and named entities — people, places, brands, and similar proper nouns — are pronounced much more accurately when written in Devanagari rather than Roman spelling.
If your text is produced by an LLM, ask it to render Indic named entities in Devanagari even when the surrounding sentence is in English. This single change can drastically improve pronunciation quality.
Example:
Better for TTS:
Match Model to Voice
Voices are model-specific. The API supports two models: standard (default) and m1. Each has its own voice catalog returned by GET /v1/voices.
- Always set
modelto the same value as the voice’smodelfield - Do not reuse a
voice_idacross models —standardvoice IDs will fail with"model": "m1", and vice versa - When switching models, fetch the voice list again and pick a voice ID from the matching catalog
Choose the Right Endpoint
Use Non-Streaming For:
- Batch processing multiple texts
- Content creation workflows
- Offline applications
- When you need complete files
Use Streaming For:
- Real-time voice assistants
- Low-latency applications
- Interactive systems
- When you need immediate audio playback
Optimize Sample Rates
- 8000 Hz: Use for telephony and bandwidth-constrained scenarios
- 16000 Hz: Good balance of quality and file size
- 24000 Hz: Use for high-quality applications (default)
Select Appropriate Audio Formats
- WAV: Best quality, larger files (default)
- MP3: Compressed, smaller files, good for web
- PCM: Raw format, for custom processing
- μ-law / A-law: Telephony standard, very small files
Ask for the format your player or telephony provider uses with output_format, rather than converting audio yourself. For phone calls, request pcm_mulaw or pcm_alaw at 8000 Hz. For real-time voice agents, request pcm_s16le, which is half the size of the default 32-bit float stream. See Output Formats.
Cache Voice Lists
Voice lists don’t change frequently. Cache the /v1/voices response to reduce API calls:
Handle Errors Gracefully
Always check response status codes and handle errors appropriately:
Optimize Text Length
For streaming endpoints, consider breaking long texts into smaller chunks:
Use Appropriate Speech Speed
- 0.5x - 0.8x: For clear, slow speech (accessibility, learning)
- 1.0x: Normal speed (default, most use cases)
- 1.2x - 1.5x: Fast speech (summaries, notifications)
speed changes standard voices only; m1 voices ignore it.
Implement Retry Logic
For production applications, implement exponential backoff:
Store API Keys Securely
Never commit API keys to version control:
Monitor Usage
Track your API usage to stay within limits:
- Monitor request counts
- Track response times
- Log errors and failures
- Set up alerts for rate limits
Test Different Voices
Test multiple voices to find the best fit:
- Different voices may work better for different content types
- Consider user preferences
- Test with actual content samples
Handle Streaming Responses
For streaming endpoints, properly handle SSE format:
Performance Tips
- Batch requests when possible for non-streaming
- Use connection pooling for multiple requests
- Compress responses when transferring over network
- Cache frequently used audio locally
- Monitor latency and optimize accordingly

