Class Orca


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

      • setSdk

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

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

        public OrcaAudio synthesize​(java.lang.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:
        An object containing the generated audio as a sequence of 16-bit linearly-encoded integers and an array of OrcaWord objects representing the word alignments.
        Throws:
        OrcaException - if there is an error while synthesizing audio.
      • synthesizeToFile

        public OrcaWord[] synthesizeToFile​(java.lang.String text,
                                           java.lang.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.
        Returns:
        An array of OrcaWord objects representing the word alignments.
        Throws:
        OrcaException - if there is an error while synthesizing audio to file.
      • getVersion

        public java.lang.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()
        Getter for the audio sampling rate of the audio produced by Orca.
        Returns:
        Audio sampling rate of the audio produced by Orca.
      • getValidCharacters

        public java.lang.String[] getValidCharacters()
        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.