# TalkAlive – Real-time WebRTC lip-sync and emotion avatar runtime (Apache-2.0)

> Source: <https://github.com/dingguoliang8-eng/TalkAlive>
> Published: 2026-12-03 05:43:34+00:00

**Key takeaway:** TalkAlive's unified adapters run MuseTalk 1.5, Wav2Lip-256/384 and QuickTalk at 25fps WebRTC with ~850ms first-emotion latency and ~3.4 GB steady VRAM on an RTX 4090 D, with `[emo:*]` tags stripped before reaching speech or subtitles.

**English** | [简体中文](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/README_ZH.md)

[Live Demo](#-live-demo) · [Why TalkAlive](#-key-highlights--why-talkalive) · [Architecture](#%EF%B8%8F-system-architecture) · [60s Quickstart](#-60-second-zero-gpu-quickstart) · [Hardware](#-hardware--lip-sync-backend-comparison) · [v2.0 White-Model Evolution](#-next-gen-architecture-v20-3d-white-model--offline-motion-transfer) · [Community](#-community--contributing)

**TalkAlive** is an **Apache-2.0** modular real-time interactive digital human engine that cleanly decouples **low-latency WebRTC lip-sync streaming**, **LLM-driven `[emo:*]` emotion choreography**, and **6 explicit-allowlist pluggable module slots**:

- 💻 **60-Second Zero-GPU Quickstart** : Run the full interactive web console, 9-state motion choreography, and streaming subtitle sanitizer on any Mac/Linux laptop with zero GPU and no API key.
- 🚀 **Seamless Switch to NVIDIA GPU Streaming** : Unified adapters for MuseTalk 1.5, Wav2Lip-256/384, and QuickTalk — verified on RTX 4090 D at**25fps live WebRTC, ~850ms first-emotion latency, and ~3.4 GB steady VRAM** .

**Captured end-to-end on an RTX 4090 D** (`MuseTalk 1.5` real-time lip-sync + `Edge-TTS` voice + local LLM streaming + 25fps WebRTC). Watch `idle` breathing → `welcome` wave → `explain` N-1 frame-anchor transition → `happy` smile → mid-sentence **6ms barge-in back to idle**. All `[emo:*]` control tags are stripped on the fly so they drive body motion without ever leaking into speech or subtitles.

## demo-live-gpu.mp4

## ⚡ 5-Emotion Quick Showcase (11.5s · 4 explain rotations + interrupt · Play Inline)

## demo-showcase.mp4

## 🧩 All 9 Avatar States Overview (7.9s · idle / welcome / thinking / explain ×4 / nod / happy · Play Inline)

## demo-9states.mp4

## 📈 Verified RTX 4090 D Benchmark Summary (click to expand)

| Metric | Measured Result | 
|---|---|
| **Lip-Sync Backend** | `musetalk-1.5` (default GPU recommendation, MIT code) | 
| **Streaming Output** | Steady **25fps** live WebRTC (1080×1920 render + 48kHz stereo audio) | 
| **First Token + Emotion Latency** | **~850 ms** (from user prompt to`[emo:welcome]` switch & first streaming delta) | 
| **Barge-In Interrupt Latency** | **< 50 ms** (cancels upstream LLM stream, flushes PCM queue, snaps to`demo_idle` ) | 
| **Steady GPU Memory** | **~3.4 GB VRAM** (easily co-hosted with local LLM + TTS on a single 24 GB GPU) | 
| **9-State Seam Quality** | Explicit BT.709 matrix + 10-frame cosine `seamlock` ,`< 0.22` drift, zero flicker | 

- ⚡ **60-Second Zero-GPU Quickstart** : Ships with a royalty-free 9-state Web Mock avatar pack and a zero-key**Local Rehearsal** mode for instant laptop evaluation.
- 🎭 **Scheme A 9-State Seamless Choreography** : Centers on 5 core emotions (`neutral / welcome / explain / nod / happy` ) with weighted (`6:3:3:1` ) anti-repeat rotation across 4`explain` gesture variants and an optional`thinking` slot (`thinking_trigger_ms=0` by default).
- 🧩 **6 Explicit-Allowlist Pluggable Slots** : Swap ASR, LLM, TTS, LipSync, Knowledge, and Tools independently with zero vendor lock-in.
- 🎬 **5 Lip-Sync Backends + Zero-Weight Compliance** : Unified runtime for`mock` ,`musetalk-1.5` ,`wav2lip-256` ,`wav2lip-384` , and`quicktalk` .**Zero model weights are committed** ; download scripts surface upstream license terms explicitly.
- ⏹ **True End-to-End Streaming Barge-In** : Triggering`interrupt` cancels the live LLM HTTP stream (`llm.interrupt(turn_id)` ), flushes TTS/PCM queues, and smoothly returns to natural dynamic`idle` .
- 🛠️ **Built-In `avatar-pack` Toolchain & Skill** : Standard CLI + AI Skill (`skills/avatar-pack` ) to turn custom footage into flicker-free, BT.709-locked 9-state avatar packs.

| Common Digital Human Pain Point | Typical Open-Source Projects | How TalkAlive Solves It | 
|---|---|---|
| **High Setup Barrier** | Requires CUDA + 10 GB weights just to see a UI | **`./scripts/quickstart.sh` launches full UI in 60s on CPU** | 
| **Stiff Loops & Flickering Cuts** | Single-clip loop or harsh color jumps on switch | **Scheme A 9-state rotation + 10-frame BT.709 `seamlock`** | 
| **Control Tags Spoken Aloud** | Fragile regex leaks `[happy]` or emojis into TTS | **128-char streaming prefix parser & sanitizer** | 
| **Half-Baked Interruption** | Mutes browser audio while LLM/TTS keep burning | **End-to-end `turn_id` cancellation + PCM flush + instant `idle`** | 
| **Hidden License Traps** | Bundles non-commercial weights silently | **Zero weights in repo + explicit license gate per engine** | 

```
flowchart LR
    subgraph Client["🌐 Browser Web UI (Zero-Build ES Module · zh/EN)"]
        UI["Chat / Subtitles / Barge-In"]
        EC["EmotionController<br/>(N-1 Frame-Anchor FSM)"]
        RTC["WebRTC / Mock Canvas"]
    end

    subgraph Runtime["⚙️ TalkAlive Runtime (FastAPI)"]
        TP["TurnPipeline<br/>Streaming FSM &amp; True Barge-In"]
        EP["EmotionPrefixParser<br/>Strips [emo:*] &amp; Emojis"]
        REG["6 Explicit-Allowlist Registries"]
    end

    subgraph Slots["🧩 6 Pluggable Slots"]
        ASR["1. ASR<br/>Whisper / SenseVoice / off"]
        LLM["2. LLM<br/>OpenAI / DeepSeek / Qwen / Ollama"]
        TTS["3. TTS<br/>Edge-TTS / OpenAI TTS"]
        KB["5. Knowledge<br/>Local Markdown BM25"]
        TL["6. Tools<br/>Time / Webhook"]
    end

    subgraph GPU["🚀 4. LipSync GPU Worker (WebRTC + PCM v1)"]
        MT["MuseTalk 1.5 (Default)"]
        W2L["Wav2Lip 256 / 384"]
        QT["QuickTalk (Research)"]
    end

    UI <-->|"HTTP / WS (/ws/chat)"| TP
    TP --> EP --> EC
    TP <--> REG
    REG --- ASR & LLM & TTS & KB & TL
    TTS -->|"PCM v1 Audio Stream"| GPU
    EC -->|"Seamless Avatar Switch"| GPU
    GPU -->|"25fps WebRTC Audio + Video"| RTC
git clone https://github.com/dingguoliang8-eng/TalkAlive.git
cd TalkAlive
./scripts/quickstart.sh
```

Starts with `LIPSYNC_BACKEND=mock` and `TTS_PROVIDER=edge_tts` at **`http://localhost:8000`** (override via `TALKALIVE_PORT=8080`).

Open `http://localhost:8000` in your browser:

1. **Zero-Key Rehearsal** : Toggle**`中文 / EN`** in the header and click**Rehearsal** to preview 5 core emotions, 9-state rotation, tool calls, and instant**`⏹ Interrupt`** .
2. **Connect Any OpenAI-Compatible LLM** : Use**LLM Settings** (memory-only, never written to disk) or export environment variables:

```
# Works with OpenAI, DeepSeek, Qwen, Ollama, vLLM, etc.
export OPENAI_BASE_URL="https://api.openai.com/v1"     # Local Ollama: http://127.0.0.1:11434/v1
export OPENAI_API_KEY="sk-your-key"                    # Local Ollama: local
export OPENAI_MODEL="gpt-4o-mini"                      # Local Ollama: qwen2.5:7b

./scripts/quickstart.sh
php
# 1. Download & verify MuseTalk 1.5 weights (explicit license prompt -> ./weights)
python scripts/download_weights.py --engine musetalk-1.5 --target-dir ./weights
python scripts/download_weights.py --engine musetalk-1.5 --target-dir ./weights --check

# 2. Bake a 9-state avatar pack into ./data/avatars
avatar-pack bake --pack-dir ./dist/demo_v1 --avatar-id demo --engine musetalk \
  --worker-root ./backends/livetalking --models-dir ./weights --output-dir ./data/avatars

# 3. Launch GPU Worker (:8010) + TalkAlive Runtime (:8000)
docker compose --profile gpu up -d --build
curl http://127.0.0.1:8000/api/v1/health
```

See [docs/deployment_en.md](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/docs/deployment_en.md) for bare-metal setup and public HTTPS/WebRTC guides.

| Use Case | Recommended Stack | Why It Fits | 
|---|---|---|
| **AI Customer Support & Concierge** | `MuseTalk 1.5` +`local_docs` +`http_webhook` | Grounded in company docs with real-time barge-in and tool callbacks | 
| **Interactive Kiosks & Expo Screens** | `MuseTalk 1.5` + 4-variant`explain` rotation | Natural gesturing across long explanations without robotic repetition | 
| **24/7 Live Streaming & Virtual Hosts** | `MuseTalk 1.5` +`Edge-TTS` / Cloud TTS | Low-latency WebRTC output with lively emotion reactions | 
| **Bilingual AI Tutors** | `MuseTalk 1.5` + Chinese/English TTS voices | Seamless zh/EN UI and voice switching over the same 9-state avatar pack | 
| **Embodied Frontend for Custom Agents** | `mock` (dev) →`MuseTalk 1.5` (prod) | Develop on a laptop without a GPU, deploy to CUDA with one config switch | 

**Zero model weights are bundled in this repo.** Download weights via `scripts/download_weights.py` after reviewing upstream terms (see [THIRD_PARTY_LICENSES.md](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/THIRD_PARTY_LICENSES.md) and [NOTICE](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/NOTICE)).

| Backend | GPU Required | VRAM (Min / Rec.) | RAM | Disk (Weights + 9-State Cache) | Performance & Best Fit | License Boundary | 
|---|---|---|---|---|---|---|
| **`mock`** | No (CPU) | 0 GB | ≥ 1 GB | 0 GB + < 50 MB demo pack | 25fps loop preview; 60s quickstart & UI/FSM dev | **Apache-2.0** , commercial-friendly | 
| **`musetalk-1.5`** | NVIDIA CUDA | 6 GB / 8–12 GB+ (~3.4 GB steady) | ≥ 8 GB | ~4.2 GB + ~2.0 GB | **≥ 25fps live streaming** , best quality/speed balance (**GPU default** ) | MIT code; verify HDTF & `face-parsing` terms | 
| **`wav2lip-256`** | NVIDIA CUDA | 4 GB / 6 GB+ | ≥ 8 GB | ~0.5 GB + ~1.0 GB | Very fast (~6–10ms/frame) for low-VRAM research | **Non-commercial research only** (LRS2) | 
| **`wav2lip-384`** | NVIDIA CUDA | 6 GB / 8 GB+ | ≥ 8 GB | ~0.6 GB + ~1.5 GB | ~12–18ms/frame, sharper mouth detail than 256 | **Non-commercial research only** (LRS2) | 
| **`quicktalk`** | NVIDIA CUDA | 8 GB / 12 GB+ | ≥ 12 GB | ~3.0 GB + ~1.8 GB | 25fps live lip-sync; opt-in via `ENABLE_QUICKTALK=1` | **Research only** (non-commercial InsightFace) | 

## 🔌 6 Pluggable Module Slots & Bilingual Voice Settings (click to expand)

| Slot | Lifecycle | Built-in Providers | Disable / Fallback | 
|---|---|---|---|
| **1. ASR** | Per-turn `create()` | `openai_whisper` ,`sensevoice_local` | `asr.enabled=false` (`off` ) | 
| **2. LLM** | App singleton | `openai_compat` (OpenAI / DeepSeek / Qwen / Ollama / vLLM) | Required (local or cloud) | 
| **3. TTS** | Per-turn `create()` | `edge_tts` (zero-key default),`openai_tts` (`f5_tts` ,`qwen3_tts` reserved) | `tts.enabled=false` (`off` ) | 
| **4. LipSync** | Session-scoped | `mock` (CPU default),`livetalking` (GPU worker client) | Auto-fallback to `mock` | 
| **5. Knowledge** | App singleton | `local_docs` (zero-DB Markdown/JSON BM25) | `knowledge.enabled=false` (`off` ) | 
| **6. Tools** | App singleton | `get_current_time` ,`http_webhook` | `tools.enabled=false` (`off` ) | 

- **Default primary voice** : Chinese (`zh-CN-XiaoxiaoNeural` , Whisper`zh` ); responds in English whenever prompted in English.
- **Switch to English voice** :

```
EDGE_TTS_VOICE=en-US-AriaNeural ./scripts/quickstart.sh
# or male voice: EDGE_TTS_VOICE=en-US-GuyNeural ./scripts/quickstart.sh
```

- **Full Deployment Guide (Zero-GPU CPU / NVIDIA GPU Docker & Bare-Metal / Weights / Baking / Public WebRTC)** :[English](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/docs/deployment_en.md) ·[简体中文](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/docs/deployment.md)
- **Full Usage Guide (6 Slots / Scheme A `[emo:*]` Tuning / Custom Avatars / Troubleshooting)** :[English](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/docs/usage_en.md) ·[简体中文](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/docs/usage.md)
- **`avatar-pack` Toolchain & Skill Docs** :[skills/avatar-pack/README.md](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/skills/avatar-pack/README.md) ·[skills/avatar-pack/SKILL.md](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/skills/avatar-pack/SKILL.md)
- **AI Coding Agent & Contributor Guide** :[AGENTS.md](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/AGENTS.md)

## 🧪 Development & Automated Tests (click to expand)

```
uv venv --python 3.12 .venv
source .venv/bin/activate
uv pip install -e ".[dev]" -e "./skills/avatar-pack"

# Full Python test suite
pytest -v

# Frontend emotion state machine & text filter tests
node --test tests/test_emotion_controller.mjs
```

While v1.0 solves robotic loop stiffness with 9-state anchored clips and frame-anchor transitions, full-body expressive performances (wide gestures, in-place dancing, expo screens, and **cylindrical holographic display pods**) still challenge pure image-to-video generation with scale drift, foot sliding, out-of-frame cropping, and unpredictable expressions.

**TalkAlive v2.0 decouples motion controllability from real-time interaction: use 3D white/gray models for spatial & skeletal precision, offline motion transfer for photorealistic identity, and keep the online GPU focused purely on low-latency 25fps real-time conversation.**

```
flowchart LR
  subgraph Offline["Offline Asset Production Pipeline (Offloaded from Live GPU)"]
    direction LR
    B["Agent + Blender Skills\nFixed Camera · Safe Spatial Bounds\nIK Skeleton · Facial BlendShapes"] --> T["Unified Timeline 3D White/Gray Model\nEnter / Loop / Exit / Interrupt\nContinuous Motion Curves"]
    T --> M["Offline End-to-End Motion Transfer\nWan-Animate-2 / Wan2.2-Animate\n+ Photorealistic Identity Anchor"]
    M --> P["Post-Processing & Automated QA\nMatting · Pure-Black Hologram Prep\nUpscaling · Scale/Foot/Seam Checks"]
  end

  P --> Pack["Standardized State Asset Pack\nIdle / Listening / Speaking\nHappy / Thinking / Dance ..."]
  Pack --> RT["TalkAlive Live Engine (Single Online GPU)\nASR · LLM Emotions & Function Call · Streaming TTS\n25fps HD Lip-Sync · Async Tool Scheduling"]
  RT --> Out["Multi-Form Outputs\nWebRTC Portrait · Expo Screens · Holographic Pods"]
```

| Engineering Challenge | Direct Image-to-Video (v1.0 Baseline) | 3D White-Model + Offline Motion Transfer (v2.0) | 
|---|---|---|
| **Unexpected scale drift** | Hard to constrain tightly | **Locked camera & character proportions in 3D** | 
| **Foot sliding / drift** | Hard to eliminate, amplified in holographic pods | **Skeletal IK + foot-ground coordinate anchoring** | 
| **Gestures clipping out of frame** | Prompt-dependent trial and error | **Pre-computed 3D safe bounding volume & collision checks** | 
| **Transition stutter** | Relies on matching first/last anchor frames | **Unified timeline `Enter / Loop / Exit / Interrupt` curves** | 
| **Center-of-gravity & physics** | Implicitly guessed by video models | **MoCap motion library + IK balance constraints** | 
| **Facial expression control** | High randomness across generations | **Gray-model BlendShape expression guidance (verified by QA)** | 

Note: Motion-transfer models do not preserve 100% of 3D control precision verbatim, so v2.0 pairs generation with automated photorealistic QA gates (identity consistency, foot stability, seam continuity, matting edges, and lip-sync cache prep) benchmarked against authorized live-action baselines.

-  **v1.0** : 60s zero-GPU quickstart, Scheme A 9-state choreography, 6 pluggable slots, 5 lip-sync adapters,`avatar-pack` CLI/Skill, RTX 4090 D seamless audiovisual verification
-  **v1.1** : Built-in`f5_tts` /`qwen3_tts` voice cloning plugins, full-duplex browser VAD barge-in, sharper localized lip-sync & inference acceleration (TensorRT / CUDA Graph)
-  **v2.0 (White-Model Pipeline & Multi-Form Architecture)** :
  -  **Blender Agent Skill + 3D White/Gray Model Pipeline** : Fixed camera, IK foot anchoring, facial BlendShapes, and continuous`Enter / Loop / Exit / Interrupt` timeline choreography
  -  **Offline Motion Transfer Workflows** : Reusable ComfyUI pipelines for`Wan-Animate-2` /`Wan2.2-Animate` plus matting, upscaling, color calibration, and automated QA scripts
  -  **Holographic Display Pod & Multi-Form Adaptation** : Pure-black`#000000` background transparency tuning, dark-wardrobe lift, and in-place safe-bounds motion packs (`Idle / Listening / Speaking / Happy / Thinking / Dance` )
  -  **Single-GPU Async Multimodal Scheduling** : Priority-isolated queues allowing Function Call async tools (e.g.,`Z-Image-Turbo` image generation) without degrading live 25fps conversation or barge-in
-  
-  **Ecosystem** : Additional royalty-free official avatar packs & PyPI release

**TalkAlive is actively evolving — contributions, ideas, and technical discussions are warmly welcome!**

Whether you want to optimize real-time lip-sync quality, build v2.0 3D white-model Blender Skills, test holographic displays, or contribute new ASR/TTS/LLM plugins, feel free to open an **Issue / Pull Request** or connect directly on WeChat:

- TalkAlive core is released under the **Apache License, Version 2.0** (see[LICENSE](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/LICENSE) ).
- The GPU worker under `backends/livetalking/` is derived from[lipku/LiveTalking](https://github.com/lipku/LiveTalking) (Apache-2.0). Please credit`LiveTalking` in public demonstrations.
- Thanks to [TMElyralab/MuseTalk](https://github.com/TMElyralab/MuseTalk) and the open-source digital human community.

If TalkAlive helps you build better real-time avatars, please consider giving it a ⭐ **Star**!
