Skip to content

Latest commit

 

History

History
149 lines (101 loc) · 3.75 KB

File metadata and controls

149 lines (101 loc) · 3.75 KB

Camb.ai C++ SDK

The official C++ SDK for interacting with Camb AI's powerful voice and audio generation APIs. Create expressive speech, unique voices, and rich soundscapes with highly performant C++ applications.

✨ Features

  • Dubbing: Dub your videos into multiple languages with voice cloning!
  • Expressive Text-to-Speech: Convert text into natural-sounding speech using a wide range of pre-existing voices.
  • Generative Voices: Create entirely new, unique voices from text prompts and descriptions.
  • Soundscapes from Text: Generate ambient audio and sound effects from textual descriptions.
  • Cross-Platform: Built using cpprestsdk for compatibility with Windows, Linux, and macOS.

📦 Installation

Prerequisites

  • CMake (3.10+)
  • C++ Compiler (C++11 or later)
  • cpprestsdk (libcpprest-dev)
  • Boost (libboost-all-dev)
  • OpenSSL (libssl-dev)

Building from Source

# Clone the repository
git clone https://github.com/Camb-ai/cambai-cpp-sdk.git
cd cambai-cpp-sdk

# Create build directory
mkdir build && cd build

# Configure and Build
cmake ..
make

Linking in your Project

If you are using CMake, you can add this SDK as a subdirectory or install it.

add_subdirectory(cambai-cpp-sdk)
target_link_libraries(your_app PRIVATE CppRestOpenAPIClient)

🔑 Authentication & Accessing Clients

To use the Camb AI SDK, you'll need an API key.

#include "CambAIClient.h"

int main() {
    cambai::CambAIClient client("YOUR_CAMB_API_KEY");
    
    // helper accessors
    auto ttsApi = client.getTextToSpeechApi();
    // ...
}

Client with Custom Provider (e.g. Baseten)

You can swap the backend provider while keeping the unified interface.

#include "CambAIClient.h"
// Implementation of ITtsProvider for Baseten provided in examples

int main() {
    cambai::CambAIClient client("KEY");
    
    // Create custom provider wrapper
    auto baseten = std::make_shared<BasetenProvider>("BASETEN_KEY", "MARS_URL");
    
    // Swap provider
    client.setTtsProvider(baseten);
    
    // Unified call
    client.tts()->tts(payload); 
}

🚀 Getting Started: Examples

NOTE: Check examples/ directory for full runnable files.

1. Text-to-Speech (TTS)

Convert text into spoken audio.

auto payload = std::make_shared<CreateTTSRequestPayload>();
payload->setText(utility::conversions::to_string_t("Hello World"));
payload->setVoiceId(20303);
payload->setLanguage(std::make_shared<Languages>(Languages::eLanguages::EN_US));

auto task = client.tts()->tts(payload);
auto result = task.get(); // Wait for Task ID

2. Text-to-Voice (Generative Voice)

Create unique voices from description.

auto payload = std::make_shared<CreateTextToVoiceRequestPayload>();
payload->setText(utility::conversions::to_string_t("Voice description prompt..."));
payload->setAge(30);

auto task = client.getTextToVoiceApi()->createTextToVoiceTextToVoicePost(payload, boost::none);

3. Text-to-Audio (Sound Generation)

Generate sound effects.

auto payload = std::make_shared<CreateTextToAudioRequestPayload>();
payload->setPrompt(utility::conversions::to_string_t("Forest sounds"));

auto task = client.getTextToAudioApi()->createTextToAudioTextToAudioPost(payload);

4. End-to-End Dubbing

Dub videos.

auto payload = std::make_shared<EndToEndDubbingRequestPayload>();
payload->setVideoUrl(utility::conversions::to_string_t("..."));
payload->setSourceLanguage(Languages::eLanguages::EN_US);
// setTargetLanguages...

auto task = client.getDubApi()->createDubDubPost(payload);

License

This project is licensed under the MIT License.