All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.givimad.whisperjni.WhisperContext Maven / Gradle / Ivy

Go to download

A JNI wrapper for [whisper.cpp](https://github.com/ggerganov/whisper.cpp), allows to transcribe speech to text in Java

The newest version!
package io.github.givimad.whisperjni;

/**
 * The {@link WhisperContext} class represents a native whisper.cpp context.
 *
 * You need to dispose the native memory for its instances by calling {@link #close}
 * or {@link WhisperJNI#free(WhisperContext)}
 *
 * @author Miguel Álvarez Díez - Initial contribution
 */
public class WhisperContext extends WhisperJNI.WhisperJNIPointer {
    private final WhisperJNI whisper;

    /**
     * Internal context constructor
     * @param whisper library instance
     * @param ref native pointer identifier
     */
    protected WhisperContext(WhisperJNI whisper, int ref) {
        super(ref);
        this.whisper = whisper;
    }
    @Override
    public void close() {
        whisper.free(this);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy