YapYapLanguageAPI is a BepInEx mod for the game YAPYAP that allows players and modders to add custom languages for voice commands. It provides a framework for registering new language packs, including voice recognition models and grammar files, and integrates them into the game's settings menu.
- Extensible Language Support: Add any language supported by the Vosk Speech Recognition Toolkit.
- Simple Configuration: Define new languages through a straightforward
languages.jsonfile. - Seamless Integration: Custom languages appear directly in the in-game voice language settings dropdown.
- Flexible File Structure: Organize your custom language model and localisation files as you see fit.
- Ensure you have BepInEx installed for YAPYAP.
- Download the latest release of
YapYapLanguageAPI.dllfrom the releases page. - Place the
YapYapLanguageAPI.dllfile inside yourYAPYAP/BepInEx/pluginsfolder. - Launch the game once to generate the necessary configuration files and directories (
languages.json,Models,Localisation).
Adding a new language involves providing a Vosk model, a localisation file with command grammar, and a definition in languages.json.
Upon first run, the API will create the following structure inside your BepInEx/plugins/ directory:
BepInEx/plugins/
├── YapYapLanguageAPI.dll
├── languages.json
├── Models/
└── Localisation/
Models/: This directory is where you should place your language-specific Vosk model folders.Localisation/: This directory is for your text files that define the vocabulary for voice commands.languages.json: This file is used to register your new language with the game.
Let's add a Dutch language pack as an example:
-
Vosk Model: Download or create a Vosk model for your desired language. Place it in a new subfolder within the
Modelsdirectory.- Example:
BepInEx/plugins/Models/vosk-model-small-nl-0.22/
- Example:
-
Localisation File: Create a
.txtfile in theLocalisationdirectory. This file will map game actions to spoken words.- Example:
BepInEx/plugins/Localisation/dutch.txt
- Example:
The format for the localisation file is key :: word1 word2 word3. Each line defines a command. The key corresponds to an in-game action, and the words to the right are the voice triggers for that action.
Example content for dutch.txt:
SPELL_ARC_ASTRAL_EYES :: ASTRALE OGEN
SPELL_ARC_BLINK :: FLITS
SPELL_ARC_GRAB_ANA :: GRIJP ANA
SPELL_ARC_LUX_ANA :: LICHT ANA
SPELL_ARC_SWAP :: WISSELOpen the languages.json file located in BepInEx/plugins/. If the file is empty or doesn't exist, the API will generate a default example. Add a new entry to the languages array for your custom language.
{
"languages": [
{
"id": "dutch",
"displayName": "Nederlands (Community)",
"systemLanguage": "Dutch",
"modelFolder": "Models/vosk-model-small-nl-0.22",
"localisationFile": "Localisation/dutch.txt",
"fallback": "english"
}
]
}"id": A unique, lowercase string to identify your language pack."displayName": The name that will be displayed in the game's settings menu (e.g., "Nederlands (Community)")."systemLanguage": The correspondingUnityEngine.SystemLanguageenum name. This is used for internal mapping. If unsure, you can fall back to"English"."modelFolder": The path to your Vosk model folder, relative to theBepInEx/plugins/directory."localisationFile": The path to your grammar/vocabulary.txtfile, relative to theBepInEx/plugins/directory."fallback": The languageidto use if your custom language fails to load.
After completing these steps, launch the game. Your new language should appear in the voice language dropdown in the settings menu.
This project is licensed under the MIT License. See the LICENSE file for details.
