feat(apiserver): add CAMB AI as TTS engine - #850
Open
neilruaro-camb wants to merge 1 commit into
Open
neilruaro-camb wants to merge 1 commit into
neilruaro-camb wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
TextToSpeechFactorywithout any structural changes.What's added
Engine:
mods/apiserver/src/voice/tts/CambAi.ts: new engine implementingAbstractTextToSpeechwith chunked synthesis via the CAMB AI streaming API. Returns raw PCM16 (WAV header stripped) so it slots into the existingsln16output flow.mods/apiserver/src/voice/tts/types.ts: newCambAiTtsConfigtype matching the existing config patterns.mods/apiserver/src/voice/tts/TextToSpeechFactory.ts: registration astts.cambai.Database:
mods/apiserver/schema.prisma: addedCAMB_AIto theProductVendorenum.mods/apiserver/migrations/20260410045143_add_cambai_vendor/migration.sql: Prisma migration for the new enum value.mods/apiserver/src/core/seed.ts: seeded thetts.cambaiproduct 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 byCAMB_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 viaproductRef: tts.cambaiin their integrations.json, exactly like they would fortts.elevenlabsortts.google. No new abstractions, no changes to the Say verb or VoiceClient.Testing
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 whenCAMB_API_KEYis 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!