Skip to content

feat: add Chatterbox as a media-use TTS provider - #3894

Open
sumit-uit wants to merge 1 commit into
heygen-com:mainfrom
sumit-uit:feat/chatterbox-tts-provider
Open

feat: add Chatterbox as a media-use TTS provider#3894
sumit-uit wants to merge 1 commit into
heygen-com:mainfrom
sumit-uit:feat/chatterbox-tts-provider

Conversation

@sumit-uit

Copy link
Copy Markdown

Summary

  • Adds Chatterbox (Resemble AI, MIT-licensed, self-hosted, zero-shot voice-clone TTS via an OpenAI-compatible /audio/speech endpoint — e.g. travisvn/chatterbox-tts-api) as a fourth provider in the media-use audio engine's TTS chain.
  • Ranked above ElevenLabs/Kokoro once its local server passes a live health check ($CHATTERBOX_BASE_URL, default http://127.0.0.1:4123/v1) — a cloned voice generally beats a generic one when the server is reachable — but below HeyGen, whose availability is credential-gated and thus already an explicit opt-in.
  • pickProvider() becomes async since Chatterbox availability needs a network round-trip (health check), unlike the other providers' plain env/credential checks. Updated the one caller in audio.mjs accordingly.
  • No word timestamps from Chatterbox itself (same limitation as ElevenLabs/Kokoro) — the existing transcribeWav() chain handles it, no new code needed there.

Why

Chatterbox is a common way to get a real cloned voice (e.g. a channel owner's own voice) into a local pipeline without a cloud TTS subscription, and several projects already wire it into custom scripts by hand. This closes that gap in media-use itself so it Just Works via --provider chatterbox (or auto, once the server is up) instead of every project reinventing the same /audio/speech call.

Test plan

  • node --test skills/media-use/audio/scripts/lib/tts.test.mjs — 18/18 passing (7 new: base-URL resolution incl. env override, chatterboxAvailable against a dead port, provider-name validation, and synthesizeChatterbox's success / HTTP-error / thrown-network-error paths, all using the same injectable-deps pattern as the existing synthesizeHeygen tests).
  • Manually verified end-to-end against a real running Chatterbox server: pickProvider(null)"chatterbox", synthesizeOne() produces a valid WAV, transcribeWav() returns correct word timings, and a full audio.mjs --request audio_request.json run synthesized 9 narration lines successfully.
  • Confirmed no other call sites needed updating (heygen-tts.mjs, npx-sync.mjs, tts-local-provider.mjs don't call pickProvider).

🤖 Generated with Claude Code

Chatterbox (Resemble AI, MIT-licensed) is a self-hosted, zero-shot
voice-clone TTS server exposing an OpenAI-compatible /audio/speech
endpoint (e.g. travisvn/chatterbox-tts-api). Add it as a fourth provider
in the media-use audio engine's chain, ranked above ElevenLabs/Kokoro
once its local server is reachable (a cloned voice generally beats a
generic one when available) but below HeyGen (credential-gated, so an
explicit opt-in already signals intent).

- lib/tts.mjs: chatterboxBaseUrl()/chatterboxAvailable() (live health
  check against $CHATTERBOX_BASE_URL, default http://127.0.0.1:4123/v1),
  a chatterbox branch in resolveVoiceId()/synthesizeOne(), and
  synthesizeChatterbox() (injectable deps, matching synthesizeHeygen's
  test pattern). pickProvider() is now async since availability requires
  a network round-trip, unlike the other providers' env/credential checks.
- audio.mjs: await the now-async pickProvider(); update the inline
  provider-list comment.
- tts.md: document the new route, its ranking, and when to reach for it.
- tts.test.mjs: 7 new tests covering base-URL resolution, availability
  on a dead port, provider validation, and synthesizeChatterbox's
  success/HTTP-error/network-error paths.

No word timestamps from Chatterbox itself (same as ElevenLabs/Kokoro) —
the caller already chains transcribeWav() for those three providers.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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