VoiceRecognitionAPI

版本 v1.2.1·更新於 2024-04-05

Loads Windows Speech recognition into Content Warning and provides a dev-friendly way of using it.

模組介紹 作者原文

VoiceRecognitionAPI

Loads Windows Speech recognition into Content Warning and provides a dev-friendly way of using it.

This is a quick fork

Original creator is LoafOrc! All props go to him.

I ported this to Content Warning very quickly, I got permission from the repo owner to reupload it.

I don't know how to git.

How do I use this

Read the original developer docs

What does this do for players?

In short - nothing. This is a simple API, instead other mods use methods from this mod to build their own features. So go check their feature list to see what voice commands they may offer.

It doesn't work properly help!

If the mod is throwing an error use the github issue page and copy-paste the error in there.

If it is loading correctly but isn't detecting your voice:

  • Make sure you have set your default microphone correctly.
  • Enable LogRecognitionResults in the mod config, found at (ContentWarningDir)/BepInEx/config/me.loaforc.voicewrapperapi.cfg. If it is getting wrong results try improving your speech recognition

Mod Usage

Download the latest dll from the releases tab and add it as a reference to the project. After adding it as a reference you can add it as a reference:

[BepInDependency(VoiceRecognitionAPI.Plugin.modGUID)]

public class YourMod: BaseUnityPlugin { //...

(Make sure to import it)

Usage

All VoiceRecognitionAPI methods are under the Voice class. It also good to note that they can NOT be defined at runtime. You should register your voice actions when your mod's Awake function is called to make sure they are registered in time. This is how to register a simple voice phrase:

Voice.ListenForPhrase("my cool voice phrase", (message) => {

logger.LogInfo("You said my cool voice phrase!");

});

If you'd like to have multiple different phrases to activate the same stuff you can do:

Voice.ListenForPhrases(new string { "my cool voice phrase", "my epic voice phrase" }, (message) => {

logger.LogInfo("Both of those phrase activate this log statement.");

});

Contributing

Uhhh so this is my first time really trying to do a public Github repo so bare with me if I screw something up.

If you'd like to build the mod for yourself:

  • Clone the repo
  • Create a.csproj.user file in the root containing:

C:\Program Files (x86)\Steam\steamapps\common\Content Warning

  • Then contribute I guess.
  • Build look you would a normal mod.
  • literally just changed Lethal Company to Content Warning, this feels wrong. This must be wrong.

安裝與使用 安裝:BepInEx 外掛

  1. 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
  2. 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
  3. 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
  4. 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。

帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack

檔案與校驗

檔案名稱
VoiceRecognitionAPI-1.2.1.zip
檔案大小
255.5 KiB