Class WhisperCpp

java.lang.Object
io.github.ggerganov.whispercpp.WhisperCpp
All Implemented Interfaces:
AutoCloseable

public class WhisperCpp extends Object implements AutoCloseable
Before calling most methods, you must call `initContext(modelPath)` to initialise the `ctx` Pointer.
  • Constructor Details

    • WhisperCpp

      public WhisperCpp()
  • Method Details

    • modelDir

      public File modelDir()
    • initContext

      public void initContext(String modelPath) throws FileNotFoundException
      Parameters:
      modelPath - - absolute path, or just the name (eg: "base", "base-en" or "base.en")
      Throws:
      FileNotFoundException
    • getFullDefaultParams

      public WhisperFullParams getFullDefaultParams(WhisperSamplingStrategy strategy)
      Provides default params which can be used with `whisper_full()` etc. Because this function allocates memory for the params, the caller must call either: - call `whisper_free_params()` - `Native.free(Pointer.nativeValue(pointer));`
      Parameters:
      strategy - - GREEDY
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
    • fullTranscribe

      public String fullTranscribe(WhisperFullParams whisperParams, float[] audioData) throws IOException
      Run the entire model: PCM -> log mel spectrogram -> encoder -> decoder -> text. Not thread safe for same context Uses the specified decoding strategy to obtain the text.
      Throws:
      IOException
    • getSystemInfo

      public String getSystemInfo()
    • benchMemcpy

      public int benchMemcpy(int nthread)
    • benchGgmlMulMat

      public int benchGgmlMulMat(int nthread)