Class Orca

java.lang.Object
ai.picovoice.orca.Orca

public class Orca extends Object
Android binding for Orca Text-to-Speech engine. Orca converts text to spoken audio without network latency.
  • Method Details

    • setSdk

      public static void setSdk(String sdk)
    • delete

      public void delete()
      Releases resources acquired by Orca.
    • synthesize

      public short[] synthesize(String text, OrcaSynthesizeParams params) throws OrcaException
      Generates audio from text. The returned audio contains the speech representation of the text.
      Parameters:
      text - Text to be converted to audio. The maximum length can be attained by calling `getMaxCharacterLimit()`. Allowed characters can be retrieved by calling `getValidCharacters()`. Custom pronunciations can be embedded in the text via the syntax `{word|pronunciation}`. The pronunciation is expressed in ARPAbet format, e.g.: `I {liv|L IH V} in {Sevilla|S EH V IY Y AH}`.
      params - Global parameters for synthesized text. See 'OrcaSynthesizeParams' for details.
      Returns:
      The output audio.
      Throws:
      OrcaException - if there is an error while synthesizing audio.
    • synthesizeToFile

      public void synthesizeToFile(String text, String outputPath, OrcaSynthesizeParams params) throws OrcaException
      Generates audio from text and saves it to a file. The file contains the speech representation of the text.
      Parameters:
      text - Text to be converted to audio. The maximum length can be attained by calling `getMaxCharacterLimit()`. Allowed characters can be retrieved by calling `getValidCharacters()`. Custom pronunciations can be embedded in the text via the syntax `{word|pronunciation}`. The pronunciation is expressed in ARPAbet format, e.g.: `I {liv|L IH V} in {Sevilla|S EH V IY Y AH}`.
      outputPath - Absolute path to the output audio file. The output file is saved as `WAV (.wav)` and consists of a single mono channel.
      params - Global parameters for synthesized text. See 'OrcaSynthesizeParams' for details.
      Throws:
      OrcaException - if there is an error while synthesizing audio to file.
    • getVersion

      public String getVersion()
      Getter for version.
      Returns:
      Version.
    • getMaxCharacterLimit

      public int getMaxCharacterLimit()
      Getter for the maximum number of characters that can be synthesized at once.
      Returns:
      The maximum number of characters that can be synthesized at once.
    • getSampleRate

      public int getSampleRate() throws OrcaException
      Getter for the audio sampling rate of the audio produced by Orca.
      Returns:
      Audio sampling rate of the audio produced by Orca.
      Throws:
      OrcaException
    • getValidCharacters

      public String[] getValidCharacters() throws OrcaException
      Getter for the set of characters that are accepted as input to Orca synthesize functions.
      Returns:
      Array of characters that are accepted as input to Orca synthesize functions.
      Throws:
      OrcaException