Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice Cheetah
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeRustUnityWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustUnityWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiRustWebWindows
AndroidC.NETiOSNode.jsPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Orca Streaming Text-to-Speech
Android API

API Reference for the Android Orca SDK (orca-android)

package: ai.picovoice.orca


Orca

public class Orca { }

Class for the Orca Streaming Text-to-Speech engine.

Orca must be initialized using the Builder() class. Resources should be cleaned when you are done using the delete() function.


Orca.delete()

public void delete()

Releases resources acquired by Orca.


Orca.getMaxCharacterLimit()

public int getMaxCharacterLimit()

Getter for the maximum number of characters that can be synthesized at once.

Returns

  • int: Maximum number of characters that can be synthesized at once.

Orca.getSampleRate()

public int getSampleRate()

Getter for the audio sampling rate of the audio produced by Orca.

Returns

  • int: Audio sampling rate of the audio produced by Orca.

Orca.getValidCharacters()

public String[] getValidCharacters()

Getter for the set of characters that are accepted as input to Orca synthesize functions.

Returns

  • String[]: Array of characters that are accepted as input to Orca synthesize functions.

Orca.getVersion()

public String getVersion()

Getter for version.

Returns

  • String: Current Orca version.

Orca.synthesize()

public OrcaAudio synthesize(
String text,
OrcaSynthesizeParams params) throws OrcaException

Generates audio from text.

Parameters

  • text String : Text to be converted to audio.
  • params OrcaSynthesizeParams : Global parameters for synthesized text.

Returns

  • OrcaAudio: Synthesized audio and word alignment metadata.

Throws

  • OrcaException: If there is an error while synthesizing audio.

Orca.synthesizeToFile()

public OrcaWord[] synthesizeToFile(
String text,
String outputPath,
OrcaSynthesizeParams params) throws OrcaException

Generates audio from text and saves it to a file.

Parameters

  • text String : Text to be converted to audio.
  • outputPath String : Absolute path to the output audio file.
  • params OrcaSynthesizeParams : Global parameters for synthesized text.

Returns

  • OrcaWord[]: Array of synthesized words with their associated metadata.

Throws

  • OrcaException: If there is an error while synthesizing audio to file.

Orca.streamOpen()

public OrcaStream streamOpen(
OrcaSynthesizeParams params) throws OrcaException

Opens an Orca.OrcaStream object for streaming input text synthesis.

Parameters

  • params OrcaSynthesizeParams : Global parameters for synthesized text.

Returns

  • Orca.OrcaStream: An instance of Orca.OrcaStream.

Throws

  • OrcaException: If there is an error while opening the OrcaStream object.

Orca.OrcaStream

public class OrcaStream { }

Class for the Orca OrcaStream object for input text streaming synthesis.

An Orca.OrcaStream object is initialized via the Orca.streamOpen() method and needs to be closed with the Orca.OrcaStream.close() method.


Orca.OrcaStream.synthesize()

public short[] synthesize(String text) throws OrcaException

Adds a chunk of text to the Orca.OrcaStream object and generates audio if enough text has been added. This function is expected to be called multiple times with consecutive chunks of text from a text stream. The incoming text is buffered as it arrives until there is enough context to convert a chunk of the buffered text into audio. The caller needs to use Orca.OrcaStream.flush() to generate the audio chunk for the remaining text that has not yet been synthesized.

Parameters

  • text String : A chunk of text (e.g. an LLM token) from a text input stream, comprised of valid characters. For details see the documentation of Orca.synthesize().

Returns

  • short[]: The generated audio as a sequence of 16-bit linearly-encoded integers, null if no audio chunk has been produced.

Throws

  • OrcaException: If there is an error while synthesizing audio.

Orca.OrcaStream.flush()

public short[] flush() throws OrcaException

Generates audio for all the buffered text that was added to the Orca.OrcaStream object via Orca.OrcaStream.synthesize().

Returns

  • short[]: The generated audio as a sequence of 16-bit linearly-encoded integers, null if no audio chunk has been produced.

Throws

  • OrcaException: If there is an error while synthesizing audio.

Orca.OrcaStream.close()

public close()

Closes the Orca.OrcaStream object and releases resources acquired by it.


Orca.Builder

public static class Builder { }

Builder for creating instance of Orca.


Orca.Builder.build()

public Orca build(Context context) throws OrcaException

Validates properties and creates an instance of the Orca Streaming Text-to-Speech engine.

Parameters

  • context Context : The Android app context.

Returns

  • Orca: An instance of Orca Streaming Text-to-Speech engine.

Throws

  • OrcaException: If an error occurs while creating an instance of Orca.

Orca.Builder.setAccessKey()

public Orca.Builder setAccessKey(String accessKey)

Sets the AccessKey.

Parameters

  • accessKey String : AccessKey obtained from Picovoice Console.

Returns

  • Orca.Builder: Modified builder object.

Orca.Builder.setModelPath()

public Orca.Builder setModelPath(String modelPath)

Sets the path to the model file.

Parameters

  • modelPath String : Absolute path to the file containing Orca model parameters.

Returns

  • Orca.Builder: Modified builder object.

OrcaSynthesizeParams

public class OrcaSynthesizeParams { }

A class that exposes properties that can control the audio synthesized by Orca.


OrcaSynthesizeParams.getSpeechRate()

public float getSpeechRate()

Getter for the speech rate (i.e. the pace of the synthesized speech).

Returns

  • float: Speech rate.

OrcaSynthesizeParams.getRandomState()

public long getRandomState()

Getter for the random state. (i.e. the random state used for the synthesized speech).

Returns

  • long: Random state.

OrcaSynthesizeParams.Builder

public static class Builder { }

Builder for creating an instance of OrcaSynthesizeParams.


OrcaSynthesizeParams.Builder.build()

public OrcaSynthesizeParams build() throws OrcaInvalidArgumentException

Validates properties and creates an instance of OrcaSynthesizeParams.

Returns

  • OrcaSynthesizeParams: An instance of OrcaSynthesizeParams.

Throws

  • OrcaInvalidArgumentException: If there is an invalid parameter.

OrcaSynthesizeParams.Builder.setSpeechRate()

public OrcaSynthesizeParams.Builder setSpeechRate(float speechRate)

Sets the speech rate.

Parameters

  • speechRate float : The pace of the synthesized speech. Valid values are within [0.7, 1.3].

Returns

  • OrcaSynthesizeParams.Builder: Modified builder object.

OrcaSynthesizeParams.Builder.setRandomState()

public OrcaSynthesizeParams.Builder setRandomState(long randomState)

Sets the random state.

Parameters

  • randomState long : The random state used for the synthesized speech.

Returns

  • OrcaSynthesizeParams.Builder: Modified builder object.

OrcaException

public class OrcaException extends Exception { }

Exception thrown if an error occurs within Orca Streaming Text-to-Speech engine.

Exceptions:

public class OrcaActivationException extends OrcaException { }
public class OrcaActivationLimitException extends OrcaException { }
public class OrcaActivationRefusedException extends OrcaException { }
public class OrcaActivationThrottledException extends OrcaException { }
public class OrcaIOException extends OrcaException { }
public class OrcaInvalidArgumentException extends OrcaException { }
public class OrcaInvalidStateException extends OrcaException { }
public class OrcaKeyException extends OrcaException { }
public class OrcaMemoryException extends OrcaException { }
public class OrcaRuntimeException extends OrcaException { }
public class OrcaStopIterationException extends OrcaException { }

OrcaAudio

public class OrcaAudio {
public OrcaAudio(short[] pcm, OrcaWord[] wordArray) { }
}

Class that contains synthesis results returned from Orca.synthesize().

Parameters

  • pcm short[] : Synthesized speech.
  • wordArray OrcaAudio.OrcaWord[] : Word alignment metadata.

OrcaAudio.getPcm()

public short[] getPcm()

Getter for the synthesized audio.

Returns

  • short[]: Synthesized audio.

OrcaAudio.getWordArray()

public OrcaWord[] getWordArray()

Getter for synthesized words and their associated metadata.

Returns

  • OrcaAudio.OrcaWord[]: Synthesized words and their associated metadata.

OrcaAudio.OrcaWord

public class OrcaWord {
public Word(String word, float startSec, float endSec, OrcaPhoneme[] phonemeArray) { }
}

Class that contains word alignment metadata returned from Orca.synthesizeToFile() and from OrcaAudio.

Parameters

  • word String : Synthesized word.
  • startSec float : Start of word in seconds.
  • endSec float : End of word in seconds.
  • phonemeArray OrcaPhoneme[] : Synthesized phonemes and their associated metadata.

OrcaAudio.OrcaWord.getWord()

public String getWord()

Getter for the synthesized word.

Returns

  • String: Synthesized word.

OrcaAudio.OrcaWord.getStartSec()

public float getStartSec()

Getter for the start of word in seconds.

Returns

  • float: Start of word in seconds.

OrcaAudio.OrcaWord.getEndSec()

public float getEndSec()

Getter for the end of word in seconds.

Returns

  • float: End of word in seconds.

OrcaAudio.OrcaWord.getPhonemeArray()

public OrcaPhoneme[] getPhonemeArray()

Getter for synthesized phonemes and their associated metadata.

Returns

  • OrcaPhoneme[]: Synthesized phonemes and their associated metadata.

OrcaAudio.OrcaWord.OrcaPhoneme

public class OrcaPhoneme {
OrcaPhoneme(String phoneme, float startSec, float endSec) { }
}

Class for storing phoneme metadata from OrcaAudio.OrcaWord.

Parameters

  • phoneme String : Synthesized phoneme.
  • startSec float : Start of phoneme in seconds.
  • endSec float : End of phoneme in seconds.

OrcaAudio.OrcaWord.OrcaPhoneme.getPhoneme()

public String getPhoneme()

Getter for the synthesized phoneme.

Returns

  • String: Synthesized phoneme.

OrcaAudio.OrcaWord.OrcaPhoneme.getStartSec()

public float getStartSec()

Getter for the start of phoneme in seconds.

Returns

  • float: Start of phoneme in seconds.

OrcaAudio.OrcaWord.OrcaPhoneme.getEndSec()

public float getEndSec()

Getter for the end of phoneme in seconds.

Returns

  • float: End of phoneme in seconds.

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Orca Streaming Text-to-Speech Android API
  • Orca
  • delete()
  • getMaxCharacterLimit()
  • getSampleRate()
  • getValidCharacters()
  • getVersion()
  • synthesize()
  • synthesizeToFile()
  • streamOpen()
  • Orca.OrcaStream
  • synthesize()
  • flush()
  • close()
  • Orca.Builder
  • build()
  • setAccessKey()
  • setModelPath()
  • OrcaSynthesizeParams
  • getSpeechRate()
  • getRandomState()
  • OrcaSynthesizeParams.Builder
  • build()
  • setSpeechRate()
  • setRandomState()
  • OrcaException
  • OrcaAudio
  • getPcm()
  • getWordArray()
  • OrcaAudio.OrcaWord
  • getWord()
  • getStartSec()
  • getEndSec()
  • getPhonemeArray()
  • OrcaAudio.OrcaWord.OrcaPhoneme
  • getPhoneme()
  • getStartSec()
  • getEndSec()
Voice AI
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Local LLM
  • picoLLM Inference
  • picoLLM Compression
  • picoLLM GYM
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Foundation Plan
  • Enterprise Plan
  • Enterprise Support
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2025 Picovoice Inc.