{"slug": "talkalive-real-time-webrtc-lip-sync-and-emotion-avatar-runtime-apache-2-0", "title": "TalkAlive – Real-time WebRTC lip-sync and emotion avatar runtime (Apache-2.0)", "summary": "TalkAlive, released under the Apache-2.0 license, is a modular real-time digital human engine that decouples low-latency WebRTC lip-sync streaming, LLM-driven `[emo:*]` emotion choreography, and six explicit-allowlist pluggable module slots. Verified on an NVIDIA RTX 4090 D, TalkAlive streams at a steady 25fps live WebRTC (1080×1920 render plus 48kHz stereo audio) with ~850ms first-token-plus-emotion latency, under 50ms barge-in interrupt latency, and ~3.4 GB steady VRAM, running MuseTalk 1.5, Wav2Lip-256/384, and QuickTalk through unified adapters. The project ships a 60-second zero-GPU quickstart with a 9-state Web Mock avatar pack and commits zero model weights, with download scripts surfacing upstream license terms.", "body_md": "**English** | [简体中文](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/README_ZH.md)\n\n[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)\n\n**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**:\n\n- 💻 **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.\n- 🚀 **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** .\n\n**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.\n\n## demo-live-gpu.mp4\n\n## ⚡ 5-Emotion Quick Showcase (11.5s · 4 explain rotations + interrupt · Play Inline)\n\n## demo-showcase.mp4\n\n## 🧩 All 9 Avatar States Overview (7.9s · idle / welcome / thinking / explain ×4 / nod / happy · Play Inline)\n\n## demo-9states.mp4\n\n## 📈 Verified RTX 4090 D Benchmark Summary (click to expand)\n\n| Metric | Measured Result | \n|---|---|\n| **Lip-Sync Backend** | `musetalk-1.5` (default GPU recommendation, MIT code) | \n| **Streaming Output** | Steady **25fps** live WebRTC (1080×1920 render + 48kHz stereo audio) | \n| **First Token + Emotion Latency** | **~850 ms** (from user prompt to`[emo:welcome]` switch & first streaming delta) | \n| **Barge-In Interrupt Latency** | **< 50 ms** (cancels upstream LLM stream, flushes PCM queue, snaps to`demo_idle` ) | \n| **Steady GPU Memory** | **~3.4 GB VRAM** (easily co-hosted with local LLM + TTS on a single 24 GB GPU) | \n| **9-State Seam Quality** | Explicit BT.709 matrix + 10-frame cosine `seamlock` ,`< 0.22` drift, zero flicker | \n\n- ⚡ **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.\n- 🎭 **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).\n- 🧩 **6 Explicit-Allowlist Pluggable Slots** : Swap ASR, LLM, TTS, LipSync, Knowledge, and Tools independently with zero vendor lock-in.\n- 🎬 **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.\n- ⏹ **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` .\n- 🛠️ **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.\n\n| Common Digital Human Pain Point | Typical Open-Source Projects | How TalkAlive Solves It | \n|---|---|---|\n| **High Setup Barrier** | Requires CUDA + 10 GB weights just to see a UI | **`./scripts/quickstart.sh` launches full UI in 60s on CPU** | \n| **Stiff Loops & Flickering Cuts** | Single-clip loop or harsh color jumps on switch | **Scheme A 9-state rotation + 10-frame BT.709 `seamlock`** | \n| **Control Tags Spoken Aloud** | Fragile regex leaks `[happy]` or emojis into TTS | **128-char streaming prefix parser & sanitizer** | \n| **Half-Baked Interruption** | Mutes browser audio while LLM/TTS keep burning | **End-to-end `turn_id` cancellation + PCM flush + instant `idle`** | \n| **Hidden License Traps** | Bundles non-commercial weights silently | **Zero weights in repo + explicit license gate per engine** | \n\n```\nflowchart LR\n    subgraph Client[\"🌐 Browser Web UI (Zero-Build ES Module · zh/EN)\"]\n        UI[\"Chat / Subtitles / Barge-In\"]\n        EC[\"EmotionController<br/>(N-1 Frame-Anchor FSM)\"]\n        RTC[\"WebRTC / Mock Canvas\"]\n    end\n\n    subgraph Runtime[\"⚙️ TalkAlive Runtime (FastAPI)\"]\n        TP[\"TurnPipeline<br/>Streaming FSM &amp; True Barge-In\"]\n        EP[\"EmotionPrefixParser<br/>Strips [emo:*] &amp; Emojis\"]\n        REG[\"6 Explicit-Allowlist Registries\"]\n    end\n\n    subgraph Slots[\"🧩 6 Pluggable Slots\"]\n        ASR[\"1. ASR<br/>Whisper / SenseVoice / off\"]\n        LLM[\"2. LLM<br/>OpenAI / DeepSeek / Qwen / Ollama\"]\n        TTS[\"3. TTS<br/>Edge-TTS / OpenAI TTS\"]\n        KB[\"5. Knowledge<br/>Local Markdown BM25\"]\n        TL[\"6. Tools<br/>Time / Webhook\"]\n    end\n\n    subgraph GPU[\"🚀 4. LipSync GPU Worker (WebRTC + PCM v1)\"]\n        MT[\"MuseTalk 1.5 (Default)\"]\n        W2L[\"Wav2Lip 256 / 384\"]\n        QT[\"QuickTalk (Research)\"]\n    end\n\n    UI <-->|\"HTTP / WS (/ws/chat)\"| TP\n    TP --> EP --> EC\n    TP <--> REG\n    REG --- ASR & LLM & TTS & KB & TL\n    TTS -->|\"PCM v1 Audio Stream\"| GPU\n    EC -->|\"Seamless Avatar Switch\"| GPU\n    GPU -->|\"25fps WebRTC Audio + Video\"| RTC\ngit clone https://github.com/dingguoliang8-eng/TalkAlive.git\ncd TalkAlive\n./scripts/quickstart.sh\n```\n\nStarts with `LIPSYNC_BACKEND=mock` and `TTS_PROVIDER=edge_tts` at **`http://localhost:8000`** (override via `TALKALIVE_PORT=8080`).\n\nOpen `http://localhost:8000` in your browser:\n\n1. **Zero-Key Rehearsal** : Toggle**`中文 / EN`** in the header and click**Rehearsal** to preview 5 core emotions, 9-state rotation, tool calls, and instant**`⏹ Interrupt`** .\n2. **Connect Any OpenAI-Compatible LLM** : Use**LLM Settings** (memory-only, never written to disk) or export environment variables:\n\n```\n# Works with OpenAI, DeepSeek, Qwen, Ollama, vLLM, etc.\nexport OPENAI_BASE_URL=\"https://api.openai.com/v1\"     # Local Ollama: http://127.0.0.1:11434/v1\nexport OPENAI_API_KEY=\"sk-your-key\"                    # Local Ollama: local\nexport OPENAI_MODEL=\"gpt-4o-mini\"                      # Local Ollama: qwen2.5:7b\n\n./scripts/quickstart.sh\nphp\n# 1. Download & verify MuseTalk 1.5 weights (explicit license prompt -> ./weights)\npython scripts/download_weights.py --engine musetalk-1.5 --target-dir ./weights\npython scripts/download_weights.py --engine musetalk-1.5 --target-dir ./weights --check\n\n# 2. Bake a 9-state avatar pack into ./data/avatars\navatar-pack bake --pack-dir ./dist/demo_v1 --avatar-id demo --engine musetalk \\\n  --worker-root ./backends/livetalking --models-dir ./weights --output-dir ./data/avatars\n\n# 3. Launch GPU Worker (:8010) + TalkAlive Runtime (:8000)\ndocker compose --profile gpu up -d --build\ncurl http://127.0.0.1:8000/api/v1/health\n```\n\nSee [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.\n\n| Use Case | Recommended Stack | Why It Fits | \n|---|---|---|\n| **AI Customer Support & Concierge** | `MuseTalk 1.5` +`local_docs` +`http_webhook` | Grounded in company docs with real-time barge-in and tool callbacks | \n| **Interactive Kiosks & Expo Screens** | `MuseTalk 1.5` + 4-variant`explain` rotation | Natural gesturing across long explanations without robotic repetition | \n| **24/7 Live Streaming & Virtual Hosts** | `MuseTalk 1.5` +`Edge-TTS` / Cloud TTS | Low-latency WebRTC output with lively emotion reactions | \n| **Bilingual AI Tutors** | `MuseTalk 1.5` + Chinese/English TTS voices | Seamless zh/EN UI and voice switching over the same 9-state avatar pack | \n| **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 | \n\n**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)).\n\n| Backend | GPU Required | VRAM (Min / Rec.) | RAM | Disk (Weights + 9-State Cache) | Performance & Best Fit | License Boundary | \n|---|---|---|---|---|---|---|\n| **`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 | \n| **`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 | \n| **`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) | \n| **`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) | \n| **`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) | \n\n## 🔌 6 Pluggable Module Slots & Bilingual Voice Settings (click to expand)\n\n| Slot | Lifecycle | Built-in Providers | Disable / Fallback | \n|---|---|---|---|\n| **1. ASR** | Per-turn `create()` | `openai_whisper` ,`sensevoice_local` | `asr.enabled=false` (`off` ) | \n| **2. LLM** | App singleton | `openai_compat` (OpenAI / DeepSeek / Qwen / Ollama / vLLM) | Required (local or cloud) | \n| **3. TTS** | Per-turn `create()` | `edge_tts` (zero-key default),`openai_tts` (`f5_tts` ,`qwen3_tts` reserved) | `tts.enabled=false` (`off` ) | \n| **4. LipSync** | Session-scoped | `mock` (CPU default),`livetalking` (GPU worker client) | Auto-fallback to `mock` | \n| **5. Knowledge** | App singleton | `local_docs` (zero-DB Markdown/JSON BM25) | `knowledge.enabled=false` (`off` ) | \n| **6. Tools** | App singleton | `get_current_time` ,`http_webhook` | `tools.enabled=false` (`off` ) | \n\n- **Default primary voice** : Chinese (`zh-CN-XiaoxiaoNeural` , Whisper`zh` ); responds in English whenever prompted in English.\n- **Switch to English voice** :\n\n```\nEDGE_TTS_VOICE=en-US-AriaNeural ./scripts/quickstart.sh\n# or male voice: EDGE_TTS_VOICE=en-US-GuyNeural ./scripts/quickstart.sh\n```\n\n- **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)\n- **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)\n- **`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)\n- **AI Coding Agent & Contributor Guide** :[AGENTS.md](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/AGENTS.md)\n\n## 🧪 Development & Automated Tests (click to expand)\n\n```\nuv venv --python 3.12 .venv\nsource .venv/bin/activate\nuv pip install -e \".[dev]\" -e \"./skills/avatar-pack\"\n\n# Full Python test suite\npytest -v\n\n# Frontend emotion state machine & text filter tests\nnode --test tests/test_emotion_controller.mjs\n```\n\nWhile 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.\n\n**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.**\n\n```\nflowchart LR\n  subgraph Offline[\"Offline Asset Production Pipeline (Offloaded from Live GPU)\"]\n    direction LR\n    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\"]\n    T --> M[\"Offline End-to-End Motion Transfer\\nWan-Animate-2 / Wan2.2-Animate\\n+ Photorealistic Identity Anchor\"]\n    M --> P[\"Post-Processing & Automated QA\\nMatting · Pure-Black Hologram Prep\\nUpscaling · Scale/Foot/Seam Checks\"]\n  end\n\n  P --> Pack[\"Standardized State Asset Pack\\nIdle / Listening / Speaking\\nHappy / Thinking / Dance ...\"]\n  Pack --> RT[\"TalkAlive Live Engine (Single Online GPU)\\nASR · LLM Emotions & Function Call · Streaming TTS\\n25fps HD Lip-Sync · Async Tool Scheduling\"]\n  RT --> Out[\"Multi-Form Outputs\\nWebRTC Portrait · Expo Screens · Holographic Pods\"]\n```\n\n| Engineering Challenge | Direct Image-to-Video (v1.0 Baseline) | 3D White-Model + Offline Motion Transfer (v2.0) | \n|---|---|---|\n| **Unexpected scale drift** | Hard to constrain tightly | **Locked camera & character proportions in 3D** | \n| **Foot sliding / drift** | Hard to eliminate, amplified in holographic pods | **Skeletal IK + foot-ground coordinate anchoring** | \n| **Gestures clipping out of frame** | Prompt-dependent trial and error | **Pre-computed 3D safe bounding volume & collision checks** | \n| **Transition stutter** | Relies on matching first/last anchor frames | **Unified timeline `Enter / Loop / Exit / Interrupt` curves** | \n| **Center-of-gravity & physics** | Implicitly guessed by video models | **MoCap motion library + IK balance constraints** | \n| **Facial expression control** | High randomness across generations | **Gray-model BlendShape expression guidance (verified by QA)** | \n\nNote: 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.\n\n-  **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\n-  **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)\n-  **v2.0 (White-Model Pipeline & Multi-Form Architecture)** :\n  -  **Blender Agent Skill + 3D White/Gray Model Pipeline** : Fixed camera, IK foot anchoring, facial BlendShapes, and continuous`Enter / Loop / Exit / Interrupt` timeline choreography\n  -  **Offline Motion Transfer Workflows** : Reusable ComfyUI pipelines for`Wan-Animate-2` /`Wan2.2-Animate` plus matting, upscaling, color calibration, and automated QA scripts\n  -  **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` )\n  -  **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\n-  \n-  **Ecosystem** : Additional royalty-free official avatar packs & PyPI release\n\n**TalkAlive is actively evolving — contributions, ideas, and technical discussions are warmly welcome!**\n\nWhether 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:\n\n- TalkAlive core is released under the **Apache License, Version 2.0** (see[LICENSE](https://github.com/dingguoliang8-eng/TalkAlive/blob/main/LICENSE) ).\n- 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.\n- Thanks to [TMElyralab/MuseTalk](https://github.com/TMElyralab/MuseTalk) and the open-source digital human community.\n\nIf TalkAlive helps you build better real-time avatars, please consider giving it a ⭐ **Star**!", "url": "https://wpnews.pro/news/talkalive-real-time-webrtc-lip-sync-and-emotion-avatar-runtime-apache-2-0", "canonical_source": "https://github.com/dingguoliang8-eng/TalkAlive", "published_at": "2026-12-03 05:43:34+00:00", "updated_at": "2026-12-03 06:18:10.608567+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "large-language-models", "generative-ai", "ai-infrastructure"], "entities": ["TalkAlive", "MuseTalk 1.5", "Wav2Lip-256", "Wav2Lip-384", "QuickTalk", "Edge-TTS", "NVIDIA RTX 4090 D"], "also_reported_by": [], "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.", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/talkalive-real-time-webrtc-lip-sync-and-emotion-avatar-runtime-apache-2-0", "markdown": "https://wpnews.pro/news/talkalive-real-time-webrtc-lip-sync-and-emotion-avatar-runtime-apache-2-0.md", "text": "https://wpnews.pro/news/talkalive-real-time-webrtc-lip-sync-and-emotion-avatar-runtime-apache-2-0.txt", "jsonld": "https://wpnews.pro/news/talkalive-real-time-webrtc-lip-sync-and-emotion-avatar-runtime-apache-2-0.jsonld"}}