leafyy aa69ee62b5 refactor(lipsync): share renderer vowel policy (#2374)
## Description

The VRM and MMD renderers had the same two boundary problems:

- Both imported the Stage audio store from the `stage-ui` source tree.
- Both kept copies of the wLipSync profile and model-neutral vowel
policy.

This PR solves both problems as one architecture change.

```text
Stage owns AudioContext and the current audio source
  -> ThreeScene / MMDScene receive both as inputs
    -> model-driver-lipsync owns the profile and shared vowel policy
      -> VRM maps AEIOU to aa / ee / ih / oh / ou
      -> MMD maps AEIOU to vowelA / vowelE / vowelI / vowelO / vowelU
```

The shared driver owns viseme projection, winner and runner selection,
silence handling, and smoothing. It has no Vue, Three.js, VRM, or MMD
dependency. Each renderer keeps only its model-specific mapping.

The renderer packages no longer import the Stage audio store or depend
directly on `wlipsync`. Stage passes the owning `AudioContext` down with
the current audio source. Cleanup disconnects only the wLipSync node
owned by that renderer.

## Current solution

The package-boundary review identified two related findings:

- Finding 3: The VRM and MMD renderers imported `stage-ui` audio state
through source paths.
- Finding 4: The same renderers duplicated the wLipSync profile and
model-neutral vowel policy.

Both findings came from one missing boundary between Stage, the lip-sync
driver, and the renderer adapters. This PR fixes that boundary with one
ownership change.

| Layer | Responsibility |
| --- | --- |
| `stage-ui` | Owns the `AudioContext` and the current audio source. It
passes both values to each renderer. |
| `stage-ui-three` and `stage-ui-mmd` | Connect renderer components to
the shared driver. They do not import the Stage audio store. |
| `model-driver-lipsync/runtime/wlipsync` | Exposes `createWLipSyncNode`
as the public runtime entry. |
| `model-driver-lipsync/shared/wlipsync` | Owns the profile, public
types, and model-neutral vowel policy. |

Runtime flow:

1. `Stage.vue` passes `audioContext` and `currentAudioSource` to
`ThreeScene` or `MMDScene`.
2. The renderer composable watches the context and creates one wLipSync
node for that context.
3. The source watcher connects the current audio source to that node.
4. Each render frame sends the wLipSync values to
`createWLipSyncVowelDriver`.
5. The renderer adapter applies the returned AEIOU weights to its model
controls.
6. Cleanup disconnects the exact source and node pair that the renderer
owns.

The shared policy keeps the current renderer behavior:

- It maps the raw `S` viseme to `I`.
- It selects the two strongest vowels.
- It uses the existing volume and silence thresholds.
- It keeps the 160 ms silence window.
- It keeps the existing attack, release, cap, and output scale values.

The renderer-specific mappings stay in their renderer packages:

- VRM maps AEIOU to `aa`, `ee`, `ih`, `oh`, and `ou`.
- MMD maps AEIOU to `vowelA`, `vowelE`, `vowelI`, `vowelO`, and
`vowelU`.

This solution removes both duplicate profile files. It also removes the
direct `wlipsync` dependencies from both renderer packages.

## Linked Issues

None.

## Additional Context

There is no intended visual change. This refactor preserves the existing
vowel weights and renderer mappings.

Verification:

- `sem diff --staged --no-cosmetics -v --file-exts .ts .tsx`
- `sem diff --staged --no-cosmetics -v --file-exts .vue`
- `sem impact --entity-id <useVRMLipSync> --json --dependents`
- `sem impact --entity-id <useMMDLipSync> --json --dependents`
- `pnpm -F @proj-airi/model-driver-lipsync test` — 3 tests passed
- `pnpm -F @proj-airi/stage-ui-three exec vitest run` — 18 tests passed
- `pnpm -F @proj-airi/stage-ui-mmd exec vitest run` — 23 tests passed
- Type checks passed for `model-driver-lipsync`, `stage-ui-three`,
`stage-ui-mmd`, and `stage-ui`
- `pnpm install --frozen-lockfile --ignore-scripts`
- `pnpm lint` — 0 errors and 7 existing warnings outside this change
- `git diff --check`

The full workspace `pnpm typecheck` was also run. In the isolated
worktree it stopped in unchanged `electron-vueuse` and
`plugin-sdk-tamagotchi` because their generated dependency outputs were
not present. All affected package type checks above passed.
2026-08-31 14:58:43 +08:00
2026-05-16 17:27:26 +08:00
2026-08-26 19:47:20 +08:00
2026-08-30 02:31:30 +08:00
2026-08-30 02:31:30 +08:00
2026-08-30 02:31:30 +08:00
2026-08-26 20:13:10 +08:00
2026-08-30 02:31:30 +08:00
2026-08-26 20:05:26 +08:00
2026-08-26 20:13:10 +08:00
2026-08-26 20:13:10 +08:00
2026-08-30 02:31:30 +08:00
2026-08-26 20:13:10 +08:00
2026-08-26 20:13:10 +08:00
2026-08-26 20:13:10 +08:00

Project AIRI

Re-creating Neuro-sama, a soul container of AI waifu / virtual characters to bring them into our world.

[Join Discord Server] [Try it] [简体中文] [日本語] [Русский] [Tiếng Việt] [Français] [한국어]

AIRI - A container of cyber living souls, re-creation of Neuro-sama | Product Hunt moeru-ai%2Fairi | Trendshift

Heavily inspired by Neuro-sama

Tip

On Windows, you can also install AIRI with winget:

winget install MoeruAI.AIRI

Or install AIRI with Scoop:

scoop bucket add airi https://github.com/moeru-ai/airi
scoop install airi/airi

On macOS, you can install AIRI with Homebrew Cask without adding a custom tap:

brew install --cask airi

Warning

Attention: We do not have any officially minted cryptocurrency or token associated with this project. Please check the information and proceed with caution.

Note

We've got a whole dedicated organization @proj-airi for all the sub-projects born from Project AIRI. Check it out!

RAG, memory system, embedded database, icons, Live2D utilities, and more!

Tip

We have a translation project on Crowdin. If you find any inaccurate translations, feel free to contribute improvements there. Crowdin | Agile localization for tech companies

Have you dreamed about having a cyber living being (cyber waifu, digital pet) or digital companion that could play with and talk to you?

With the power of modern large language models like ChatGPT and famous Claude, asking a virtual being to roleplay and chat with us is already easy enough for everyone. Platforms like Character.ai (a.k.a. c.ai) and JanitorAI as well as local playgrounds like SillyTavern are already good-enough solutions for a chat based or visual adventure game like experience.

But, what about the abilities to play games? And see what you are coding at? Chatting while playing games, watching videos, and is capable of doing many other things.

Perhaps you know Neuro-sama already. She is currently the best virtual streamer capable of playing games, chatting, and interacting with you and the participants. Some also call this kind of being "digital human." Sadly, as it's not open sourced, you cannot interact with her after her live streams go offline.

Therefore, this project, AIRI, offers another possibility here: let you own your digital life, cyber living, easily, anywhere, anytime.

Recent DevLogs & Stories

What's So Special About This Project?

Unlike the other AI driven VTuber open source projects, アイリ was built with support of many Web technologies such as WebGPU, WebAudio, Web Workers, WebAssembly, WebSocket, etc. from the first day.

Tip

Worrying about the performance drop since we are using Web related technologies?

Don't worry, while the Web browser version is meant to give an insight into how much we can push and do inside browsers and webviews, we will never fully rely on this. The desktop version of AIRI is capable of using native NVIDIA CUDA and Apple Metal by default (thanks to HuggingFace & the beloved candle project), without any complex dependency management. Considering the tradeoff, it is partially powered by Web technologies for graphics, layouts, animations, and the WIP plugin system for everyone to integrate things.

This means that アイリ is capable of running on modern browsers and devices and even on mobile devices (already done with PWA support). This brings a lot of possibilities for us (the developers) to build and extend the power of アイリ VTuber to the next level, while still leaving the flexibility for users to enable features that require TCP connections or other non-Web technologies such as connecting to a Discord voice channel or playing Minecraft and Factorio with friends.

Note

We are still in the early stage of development where we are seeking out talented developers to join us and help us to make アイリ a reality.

It's ok if you are not familiar with Vue.js, TypeScript, and devtools required for this project, you can join us as an artist, designer, or even help us to launch our first live stream.

Even if you are a big fan of React, Svelte or even Solid, we welcome you. You can open a sub-directory to add features that you want to see in アイリ, or would like to experiment with.

Fields (and related projects) that we are looking for:

  • Live2D modeller
  • VRM modeller
  • VRChat avatar designer
  • Computer Vision
  • Reinforcement Learning
  • Speech Recognition
  • Speech Synthesis
  • ONNX Runtime
  • Transformers.js
  • vLLM
  • WebGPU
  • Three.js
  • WebXR (checkout the another project we have under the @moeru-ai organization)

If you are interested, why not introduce yourself here? Would like to join part of us to build AIRI?

Current Progress & Roadmap

Capable of

  • Brain
  • Ears
    • Audio input from browser
    • Audio input from Discord
    • Client side speech recognition
    • Client side talking detection
  • Mouth
    • Multi-provider voice synthesis, including ElevenLabs, Microsoft/Azure Speech, OpenAI-compatible TTS, Alibaba Cloud Model Studio, and local Kokoro TTS
  • Body
    • VRM support
      • Control VRM model
    • VRM model animations
      • Auto blink
      • Auto look at
      • Idle eye movement
    • Live2D support
      • Control Live2D model
    • Live2D model animations
      • Auto blink
      • Auto look at
      • Idle eye movement

Development

For detailed instructions to develop this project, follow CONTRIBUTING.md

Note

By default, pnpm dev will start the development server for the Stage Web (browser version). If you would like to try developing the desktop version, please make sure you read CONTRIBUTING.md to setup the environment correctly.

pnpm i
pnpm dev

Stage Web (Browser Version at airi.moeru.ai)

pnpm dev

Stage Tamagotchi (Desktop Version)

pnpm dev:tamagotchi

A Nix package for Tamagotchi is included. To run airi with Nix, first make sure to enable flakes, then run:

nix run github:moeru-ai/airi

NixOS

Electron requires shared libraries that aren't in standard paths on NixOS. Use the FHS shell defined in flake.nix:

nix develop .#fhs
pnpm dev:tamagotchi

Stage Pocket (Mobile Version)

Start the development server for the capacitor:

pnpm dev:pocket:ios --target "<DEVICE_ID_OR_SIMULATOR_NAME>"
# Or
CAPACITOR_DEVICE_ID_IOS="<DEVICE_ID_OR_SIMULATOR_NAME>" pnpm dev:pocket:ios

Quote the target: simulator names such as iPhone 16 Pro contain spaces.

You can see the list of available devices and simulators by running pnpm -F @proj-airi/stage-pocket exec cap run ios --list. @capacitor/cli is declared in apps/stage-pocket, so cap does not resolve from the repository root.

If you need to connect server channel on pocket in wireless mode, you need to start tamagotchi as root:

sudo pnpm dev:tamagotchi

Then enable secure websocket in tamagotchi settings/connections.

Documentation Site

pnpm dev:docs

Publish

Run bumpp to update the monorepo version:

npx bumpp --no-commit --no-tag

Support of LLM API Providers (powered by xsai)

Sub-projects Born from This Project

flowchart LR
  subgraph Apps[Stage applications]
    Web[stage-web]
    Desktop[stage-tamagotchi]
    Pocket[stage-pocket\nexperimental]
  end

  subgraph Shared[Shared product packages]
    StageUI[stage-ui]
    Domain[core-agent\ncore-character]
    Audio[pipelines-audio]
    Renderers[stage-ui-live2d\nstage-ui-three and renderers]
    SDK[server-sdk\nserver-shared]
  end

  subgraph Channel[Desktop server channel]
    Runtime[server-runtime]
  end

  subgraph Integrations[Source-configured integrations]
    Discord[discord-bot]
    Minecraft[minecraft-bot]
    Other[Telegram, Factorio, MCP, and others]
  end

  subgraph Hosted[Hosted backend]
    Edge[Caddy]
    API[api-server]
    Auth[auth-server]
    Database[(PostgreSQL)]
    Cache[(Redis)]
  end

  Web --> StageUI
  Desktop --> StageUI
  Pocket --> StageUI
  StageUI --> Domain
  StageUI --> Audio
  StageUI --> Renderers
  StageUI --> SDK
  Desktop --> Runtime
  SDK <-->|server channel| Runtime
  Discord --> SDK
  Minecraft --> SDK
  Other -. optional .-> SDK
  Edge --> API
  Edge --> Auth
  API --> Database
  API --> Cache
  Auth --> Database
  Auth --> Cache

Similar Projects

Open sourced ones

Non-open-sourced ones

Project Status

Repobeats analytics image

Acknowledgements

Supporters

Thank you for supporting Project AIRI through OpenCollective, Patreon, and Ko-fi.

Project AIRI supporters

Special Thanks

Special thanks to all contributors for their contributions to Project AIRI ❤️

Star History

Star History Chart
S
Description
Re-creating Neuro-sama, a soul container of AI waifu / virtual characters to bring them into our world.
Readme MIT
525 MiB
Languages
TypeScript 73.5%
Vue 24.5%
JavaScript 1.2%
CSS 0.4%
HTML 0.2%
Other 0.2%