Overview
Tabbly TTS provides a streaming Text-to-Speech API that allows you to generate high-quality voice audio in real-time for your voice AI applications. The API streams audio as it’s generated, providing low-latency responses for real-time use cases.Base URL
Endpoint
Authentication
All requests require an API key passed via theX-API-Key header.
Your Tabbly TTS API key
Request
The text to convert to speech
Voice ID to use for synthesis. Default: “Ashley”
Model ID to use. Default: “tabbly-tts”
Response
Content-Type:audio/wav or application/octet-stream
Format: LINEAR16 PCM, 48kHz, mono
Streaming: Yes - audio is streamed as it’s generated
Protocol: HTTP streaming with WAV-encoded audio chunks embedded in the stream
Example Request
Audio Format
48000 Hz (fixed)
1 (mono)
16-bit
LINEAR16 PCM
audio/wav (stream may contain embedded WAV files)
WAV Header Processing
The response may include WAV files embedded in the stream. When processing the stream:- Detect WAV Headers: Look for
RIFFandWAVEmarkers - Extract PCM Data: Find the
datachunk and extract raw PCM audio - Handle Multiple WAV Files: The stream may contain multiple WAV files
- Process Audio Chunks: Handle audio data as it arrives for real-time playback
WAV File Structure
Processing Tips
- Skip Headers: First 44 bytes typically contain WAV header
- Extract Data Chunk: Look for
datamarker to find audio start - Handle Multiple Files: Stream may contain multiple WAV files sequentially
- Frame Alignment: Ensure chunks are aligned to 16-bit sample boundaries (even bytes)
Error Responses
Bad Request - Invalid parameters or missing required fields
Unauthorized - Invalid or missing API key
Payment Required - Insufficient wallet balance
Server error
Rate Limits
API rate limits apply to prevent abuse. Contact support if you need higher limits.Best Practices
Stream Processing
Stream Processing
Process audio chunks as they arrive rather than waiting for the complete response. This reduces latency and enables real-time playback.
WAV Processing
WAV Processing
The API may send WAV files embedded in the stream. Always extract PCM data from WAV chunks for proper playback. See code examples above.
Error Handling
Error Handling
Always handle HTTP errors and network timeouts gracefully. Implement retry logic for transient failures.
Voice Selection
Voice Selection
Choose appropriate voice_id based on your use case. Different voices may have different characteristics and languages.
Text Length
Text Length
For very long texts, consider splitting into smaller chunks for better streaming performance and lower latency.
Connection Reuse
Connection Reuse
Reuse HTTP client connections when making multiple requests to improve performance and reduce connection overhead.
Buffering
Buffering
For real-time playback, implement buffering (10-20ms) to smooth out network jitter and prevent audio artifacts.
Frame Alignment
Frame Alignment
Ensure audio chunks are aligned to 16-bit sample boundaries (even number of bytes) to prevent audio clicks or pops.
Troubleshooting
No Audio Output
- Verify API key is correct and has sufficient wallet balance
- Check network connectivity to
https://api.tabbly.io - Review response status code (should be 200)
- Verify WAV headers are being detected and processed correctly
- Check logs for HTTP connection errors
Audio Quality Issues
- Ensure sample rate matches (48000 Hz)
- Verify WAV header parsing is working correctly
- Check audio data format (should be LINEAR16 PCM)
- Ensure frame alignment (even number of bytes per chunk)
- Check for proper PCM extraction from WAV files
Performance Issues
- Reuse HTTP client instances for better performance
- Monitor API response times
- Consider caching for repeated text
- Implement proper buffering for real-time playback
- Check network latency to API endpoint
WAV Processing Issues
- Verify WAV headers are being detected (
RIFFandWAVEmarkers) - Check if
datachunk is being found correctly - Ensure multiple WAV files in stream are handled properly
- Verify PCM data extraction is working
- Check for incomplete WAV files (keep in buffer until complete)
Integration Examples
Real-Time Playback
For real-time playback, implement buffering to smooth out network jitter:Next Steps
- Learn how to integrate with LiveKit: LiveKit Integration
- Review best practices: Best Practices
- Get your API key from the Tabbly dashboard
- Review example implementations in the code samples above