promotional bannermobile promotional banner
premium banner
Fork of VoskLib. A voice recognition mod for Minecraft

Description

🎀 WhisperLib

An Event-based voice recognition mod that uses WhisperAI to transcript audio to text. Forked from VoskLib.


✨ Features

  1. Offline Recognition: Uses WhisperAI offline. No audio is sent to servers!
  2. Completely Client-side: The mod does not run WhisperAI to any Minecraft server.
  3. Built-in Model Manager: The mod includes a built-in Model Manager.
  4. Dynamic Loading: Displays avaliable models from HuggingFace.
  5. Adjustable Microphone Settings: Added settings screen to adjust mic related settings that wasn't in VoskLib yet.
  6. Security Feature: Immediately gets you notified when WhisperLib is listening.

πŸ“¦ Installation for Users

  1. Download this mod from Curseforge.
  2. Launch the game and click Mods button.
  3. Locate WhisperLib and press Config.
  4. Select your model and press Download.
  5. After downloading, click your downloaded model.
  6. Pres Save & Exit.

That's it.


πŸ”¨ Installation for Developers

  1. Locate build.gradle.

  2. 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"))
    }
  3. Build the project and check if there's any issues.

  4. 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