Open-LLM-VTuber icon indicating copy to clipboard operation
Open-LLM-VTuber copied to clipboard

[BUG] Cartesia TTS: Live2D mouth does not move (lip sync broken) due to pcm_f32le audio encoding

Open Conallanes opened this issue 5 months ago • 1 comments

[BUG] Cartesia TTS: Live2D mouth does not move (lip sync broken) due to pcm_f32le audio encoding

Description

When using cartesia_tts as the TTS engine, the Live2D model loads and speaks correctly (audio plays, motions trigger), but the mouth does NOT move during speech. No errors are thrown in either the backend or frontend console — the volumes array is still sent to the frontend, but lip sync visibly does not work.

This happens with the default mao_pro model, so it is not specific to any custom model. I confirmed this with a clean A/B test: switching tts_model to edge_tts (everything else identical) immediately fixes lip sync. Switching back to cartesia_tts reproduces the issue every time.

Root Cause

In src/open_llm_vtuber/tts/cartesia_tts.py, the WAV output format requests 32-bit float PCM:

wav_output_format: OutputFormat_WavParams = {
    "container": "wav",
    "sample_rate": 44100,
    "encoding": "pcm_f32le",
}

This differs from other TTS engines (e.g. edge_tts), which produce standard 16-bit PCM (pcm_s16le). Whatever module is responsible for computing the volumes array for lip sync appears to only handle 16-bit PCM correctly — when fed pcm_f32le audio, it does not throw an exception, but the resulting volume data is effectively unusable for driving the mouth parameter (silent failure, no crash, no error log).

Fix

Changing the encoding from pcm_f32le to pcm_s16le in cartesia_tts.py resolves the issue completely:

wav_output_format: OutputFormat_WavParams = {
    "container": "wav",
    "sample_rate": 44100,
    "encoding": "pcm_s16le",  # changed from pcm_f32le
}

After this change, lip sync works correctly with Cartesia TTS, matching the behavior of edge_tts.

Steps to Reproduce

  1. Set tts_model: 'cartesia_tts' in conf.yaml with a valid API key
  2. Use the default mao_pro Live2D model (or any model)
  3. Start a conversation and let the AI respond with voice
  4. Observe: audio plays, Talk motion triggers, but mouth parameter does not animate
  5. Switch tts_model to edge_tts (no other changes) → mouth animates correctly
  6. Switch back to cartesia_tts → issue reproduces

Environment

  • Open-LLM-VTuber version: v1.2.1
  • OS: Windows 11
  • TTS: cartesia_tts (model_id: sonic-3, output_format: wav)
  • Live2D model tested: mao_pro (built-in default)

Suggested Fix

Change encoding from "pcm_f32le" to "pcm_s16le" in the wav_output_format dict in src/open_llm_vtuber/tts/cartesia_tts.py. Happy to submit a PR with this one-line change if that's preferred.

Conallanes avatar Jun 28 '26 06:06 Conallanes

I will check the Cartesia WAV format against the audio payload/lip-sync path and add a regression test for PCM16 output, keeping MP3 output unchanged.

wsj040303 avatar Oct 16 '26 07:10 wsj040303