Overview
The Camb.ai Java SDK provides a simple interface to integrate high-quality text-to-speech into your applications. This quickstart will have you generating speech in under 5 minutes.Installation
Gradle
Add the dependency to yourbuild.gradle:
Maven
Add the dependency to yourpom.xml:
Authentication
Get your API key from CAMB.AI Studio and set it as an environment variable:Quick Start
Streaming Text-to-Speech
Generate and stream speech in real-time. The SDK returns anInputStream for the audio data:
Using the Helper Function
You can easily wrap the stream saving into a helper method:Choosing a Model
Camb.ai offers three MARS models optimized for different use cases:MARS Flash
Sample rate: 22.05kHz
MARS Pro
Sample rate: 48kHz
MARS Instruct
Sample rate: 22.05kHz
Listing Available Voices
Discover available voices for your application:Language Support
Camb.ai supports 140+ languages. Specify the language using theCreateStreamTtsRequestPayloadLanguage enum:
Languages supported by each model mentioned at MARS Models.
Error Handling
Handle common errors gracefully:Using Custom Provider
For more details check this guide Custom Cloud ProvidersBaseten Deployment
Initialize the client with your custom provider implementation. Baseten Provider ExampleNext Steps
Voice Agents
Build real-time voice agents with Pipecat
LiveKit Integration
Create voice agents with LiveKit
API Reference
Explore the full TTS API
Voice Library
Browse available voices