A robust mod for MateEngine that adds fully dynamic text-based lip syncing and accurate facial expression handling (Joy, Fun, Angry, etc.) directly triggered by the messages from SillyTavern.
This repository provides a custom patch to optimize audio-driven lip-syncing for 3D VRM models operating in Mate Engine X while receiving conversational outputs from SillyTavern extensions. It includes the core C# implementation and an automated PowerShell script to easily compile and apply the modifications to your local environment.
BetterLipSync.cs: The core C# logic overriding or improving the default avatar lip-sync behavior.MateEnginePatch.csproj: The .NET project file required to compile the C# patch.Patch-SillyTavern.ps1: A PowerShell automation script designed to handle the installation and configuration of the patch alongside your SillyTavern instance.
"By default, MateEngine's text lip-sync by tts from Sillytavern is not working. This patch completely fixes it." If you are starting from scratch and want to set up 3D animated characters interacting with SillyTavern on your Windows PC, follow this complete, step-by-step guide.
First, you need to download and install the two main programs.
-
Download SillyTavern:
- Head over to the official repository: SillyTavern GitHub
- Follow their official installation guide to set it up (requires Node.js).
-
Download MateEngine X:
- This is the 3D application that renders the characters.
- Download the latest Windows release directly here: MateEngineWin3.2.7z
- Official Repository Link: LazyCodingKing/MateEngine-Sillytavern
- Extract the
.7zfile using 7-Zip or WinRAR to a folder on your computer (for example,C:\MateEngine).
By default, MateEngine's text lip-sync by tts is not working. This patch completely fixes it.
- Download the latest
MateEnginePatch.dllandPatch-SillyTavern.ps1from this repository. - Open the folder where you extracted MateEngine.
- Navigate into
MateEngineX_Data\Managed. - Paste the
MateEnginePatch.dllfile there.
For MateEngine to know when the character speaks, we need to link it to SillyTavern's Text-to-Speech system. I've included an automated tool that does this instantly for you!
- Open Windows PowerShell on your computer.
- Navigate to the folder where you downloaded
Patch-SillyTavern.ps1, then copy and paste the following command. Make sure to replace the path with where your actual SillyTavern folder is located:
.\Patch-SillyTavern.ps1 -SillyTavernPath "C:\Your\Path\To\SillyTavern"- Hit Enter! The script will safely inject the necessary hooks.
You're completely done! Start SillyTavern, start MateEngine, load a character, and start chatting. You will now see perfect lip-syncing and facial expressions!.
- Build the
.csprojtargeting.NET Framework 4.7.1(net471). Do not use.NET Standardor Unity will fail to load the assembly.
Unlike the original basic implementation which relied on AccumulateValue without ever flushing the buffers (causing faces to freeze or fail to animate), this patch uses a dedicated LateUpdate driver with a high execution order ([DefaultExecutionOrder(32000)]). This ensures that our facial visemes and expressions securely override any standard animations MateEngine might be playing, allowing custom expressions (Joy, Fun, Angry, etc.) triggered by SillyTavern's LLM to render properly without being wiped out by idle animations.