Class Leopard


  • public class Leopard
    extends java.lang.Object
    Class for the Leopard Speech-to-Text engine.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  Leopard.Builder
      Builder for creating an instance of Leopard with a mixture of default arguments.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String LIBRARY_PATH  
      static java.lang.String MODEL_PATH  
      static java.util.List<java.lang.String> VALID_EXTENSIONS  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void delete()
      Releases resources acquired by Leopard.
      int getSampleRate()
      Getter for required audio sample rate for PCM data.
      java.lang.String getVersion()
      Getter for Leopard version.
      LeopardTranscript process​(short[] pcm)
      Processes given audio data and returns its transcription.
      LeopardTranscript processFile​(java.lang.String path)
      Processes given audio file and returns its transcription.
      static void setSdk​(java.lang.String sdk)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • LIBRARY_PATH

        public static final java.lang.String LIBRARY_PATH
      • MODEL_PATH

        public static final java.lang.String MODEL_PATH
      • VALID_EXTENSIONS

        public static final java.util.List<java.lang.String> VALID_EXTENSIONS
    • Method Detail

      • setSdk

        public static void setSdk​(java.lang.String sdk)
      • delete

        public void delete()
        Releases resources acquired by Leopard.
      • process

        public LeopardTranscript process​(short[] pcm)
                                  throws LeopardException
        Processes given audio data and returns its transcription.
        Parameters:
        pcm - A frame of audio samples. The incoming audio needs to have a sample rate equal to getSampleRate() and be 16-bit linearly-encoded. Furthermore, Leopard operates on single channel audio only.
        Returns:
        LeopardTranscript object which contains the transcription results of the engine.
        Throws:
        LeopardException - if there is an error while processing the audio frame.
      • processFile

        public LeopardTranscript processFile​(java.lang.String path)
                                      throws LeopardException
        Processes given audio file and returns its transcription.
        Parameters:
        path - Absolute path to the audio file. The supported formats are: `3gp (AMR)`, `FLAC`, `MP3`, `MP4/m4a (AAC)`, `Ogg`, `WAV`, `WebM`
        Returns:
        LeopardTranscript object which contains the transcription results of the engine.
        Throws:
        LeopardException - if there is an error while processing the audio frame.
      • getSampleRate

        public int getSampleRate()
        Getter for required audio sample rate for PCM data.
        Returns:
        Required audio sample rate for PCM data.
      • getVersion

        public java.lang.String getVersion()
        Getter for Leopard version.
        Returns:
        Leopard version.