Skip to content

feat(apiserver): add CAMB AI as TTS engine - #850

Open
neilruaro-camb wants to merge 1 commit into
fonoster:mainfrom
neilruaro-camb:add-camb-ai-tts
Open

neilruaro-camb wants to merge 1 commit into
fonoster:mainfrom
neilruaro-camb:add-camb-ai-tts

Conversation

@neilruaro-camb

Copy link
Copy Markdown

Summary

This PR adds CAMB AI as a TTS engine option for the Say verb. CAMB AI is the localization engine of choice for brands like the Premier League, NBA, NASCAR, and the Australian Open, and we'd love to be available as a TTS option in Fonoster for users who want high quality multilingual voice synthesis on their voice apps.

The integration follows the exact same pattern as the existing Google, ElevenLabs, Deepgram, and Azure TTS engines, so it slots into the existing TextToSpeechFactory without any structural changes.

What's added

Engine:

  • mods/apiserver/src/voice/tts/CambAi.ts: new engine implementing AbstractTextToSpeech with chunked synthesis via the CAMB AI streaming API. Returns raw PCM16 (WAV header stripped) so it slots into the existing sln16 output flow.
  • mods/apiserver/src/voice/tts/types.ts: new CambAiTtsConfig type matching the existing config patterns.
  • mods/apiserver/src/voice/tts/TextToSpeechFactory.ts: registration as tts.cambai.

Database:

  • mods/apiserver/schema.prisma: added CAMB_AI to the ProductVendor enum.
  • mods/apiserver/migrations/20260410045143_add_cambai_vendor/migration.sql: Prisma migration for the new enum value.
  • mods/apiserver/src/core/seed.ts: seeded the tts.cambai product on startup.

Config:

  • config/integrations.example.json: added a CAMB AI TTS integration example so users know what shape the credentials object takes.

Tests:

  • mods/apiserver/test/voice/tts/cambAi.test.ts: Mocha + Chai + Sinon tests covering engine instantiation, payload format, WAV header stripping, error propagation, model overrides, schema validation, factory registration, and a live API integration test guarded by CAMB_API_KEY. 11 tests total, all passing.

How it fits in

CAMB AI is a TTS-only provider, so it slots in next to the existing four engines registered in TextToSpeechFactory. Users configure it via productRef: tts.cambai in their integrations.json, exactly like they would for tts.elevenlabs or tts.google. No new abstractions, no changes to the Say verb or VoiceClient.

Testing

LOGS_LEVEL=none NODE_ENV=development npx mocha --timeout 30000 \
  --node-option 'import=tsx' \
  'mods/apiserver/test/voice/tts/cambAi.test.ts'

Unit tests run with stubbed fetch. The integration test (@voice/tts/CambAi - Integration > should synthesize speech with real API) hits the real CAMB AI API when CAMB_API_KEY is set in the environment, otherwise it skips.

About CAMB AI

CAMB AI provides MARS speech models with sub-150ms latency on mars-flash, voice cloning from short reference samples, and 16+ language support including English, Spanish, French, German, Japanese, Hindi, Portuguese, and Chinese. More info at https://camb.ai and https://studio.camb.ai.

Happy to iterate on anything: naming, code style, file locations, test coverage, the way the engine handles audio format conversion, or anything else. Thanks for considering this addition!

Adds CAMB AI as a new TTS engine option for the Say verb. Follows
the same pattern as the existing Google, ElevenLabs, Deepgram, and
Azure TTS engines so it slots into the existing TextToSpeechFactory
without any structural changes.

CAMB AI provides MARS speech models with sub-150ms latency on
mars-flash, voice cloning from short reference samples, and 16+
language support.

Changes:
* New CambAi.ts engine implementing AbstractTextToSpeech with
  chunked synthesis via the CAMB AI streaming API and WAV header
  stripping for raw PCM output
* New CambAiTtsConfig type in types.ts
* Engine registration in TextToSpeechFactory under tts.cambai
* CAMB_AI added to the ProductVendor enum in schema.prisma
* Prisma migration for the new enum value
* tts.cambai product seeded in seed.ts
* CAMB AI integration example added to integrations.example.json
* Test suite at mods/apiserver/test/voice/tts/cambAi.test.ts with
  unit tests, factory tests, and a live API integration test
@neilruaro-camb
neilruaro-camb requested a review from efraa as a code owner April 10, 2026 08:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant