🎤 WhisperLib
An Event-based voice recognition mod that uses WhisperAI to transcript audio to text. Forked from VoskLib.
✨ Features
- Offline Recognition: Uses WhisperAI offline. No audio is sent to servers!
- Completely Client-side: The mod does not run WhisperAI to any Minecraft server.
- Built-in Model Manager: The mod includes a built-in Model Manager.
- Dynamic Loading: Displays avaliable models from HuggingFace.
- Adjustable Microphone Settings: Added settings screen to adjust mic related settings that wasn't in VoskLib yet.
- Security Feature: Immediately gets you notified when WhisperLib is listening.
📦 Installation for Users
- Download this mod from Curseforge.
- Launch the game and click
Mods button.
- Locate
WhisperLib and press Config.
- Select your model and press
Download.
- After downloading, click your downloaded model.
- Pres
Save & Exit.
That's it.
🔨 Installation for Developers
-
Locate build.gradle.
-
Add the following:
dependencies {
// ...your dependencies
// Make sure it's in our Runtime (Do not shade these libraries)
implementation 'io.github.givimad:whisper-jni:1.7.1'
runtimeOnly 'io.github.givimad:whisper-jni:1.7.1'
// Include the dev mod jar
implementation fg.deobf(files("libs/whisperlib--dev.jar"))
}
-
Build the project and check if there's any issues.
-
If there's, you can contact me via Curseforge PMs or GitHub issues.
🔌 WhisperLib API
// Start Listening
VoiceManager.startListening();
// Stop Listening
VoiceManager.stopListening();
WhisperLib and VoskLib are posting their results in Forge Event Bus at Client-side.
@Mod.EventBusSubscriber(modid = "examplemod", bus = Mod.EventBusSubscriber.Bus.FORGE, value = Dist.CLIENT)
public class VoiceEvents {
@SubscribeEvent
public static void onResult(WhisperVoiceResult event) {
// Get the full text.
String result = event.getText();
if (result.toLowerCase().contains("hello")) {
System.out.println("Hi!");
}
// Use the following method to exclude messages like:
// [MUSIC], [upbeat music], etc. (does not exclude *laughing*)
String filteredText = event.getSpokenText();
// do more processing...
}
}
📜 Credits