Orca Text-to-Speech
Android API
API Reference for the Android Orca SDK (orca-android)
package: ai.picovoice.orca
Orca
Class for the Orca 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()
Releases resources acquired by Orca
.
Orca.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()
Getter for the audio sampling rate of the audio produced by Orca.
Returns
int
: Audio sampling rate of the audio produced by Orca.
Throws
OrcaException
: If there is an error while getting the sample rate.
Orca.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.
Throws
OrcaException
: If there is an error while getting the valid characters.
Orca.getVersion()
Getter for version.
Returns
String
: CurrentOrca
version.
Orca.synthesize()
Generates audio from text.
Parameters
text
String : Text to be converted to audio.params
OrcaSynthesizeParams
: Global parameters for synthesized text.
Returns
short[]
: The output audio.
Throws
OrcaException
: If there is an error while synthesizing audio.
Orca.synthesizeToFile()
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.
Throws
OrcaException
: If there is an error while synthesizing audio to file.
Orca.Builder
Builder for creating instance of Orca.
Orca.Builder.build()
Validates properties and creates an instance of the Orca Text-to-Speech engine.
Parameters
context
Context : The Android app context.
Returns
Orca
: An instance of Orca Text-to-Speech engine.
Throws
OrcaException
: If an error occurs while creating an instance of Orca.
Orca.Builder.setAccessKey()
Sets the AccessKey.
Parameters
accessKey
String : AccessKey obtained from Picovoice Console.
Returns
Orca.Builder
: Modified builder object.
Orca.Builder.setModelPath()
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
A class that exposes properties that can control the audio synthesized by Orca.
OrcaSynthesizeParams.getSpeechRate()
Getter for the speech rate (i.e. the pace of the synthesized speech).
Returns
float
: Speech rate.
OrcaSynthesizeParams.Builder
Builder for creating an instance of OrcaSynthesizeParams
.
OrcaSynthesizeParams.Builder.build()
Validates properties and creates an instance of OrcaSynthesizeParams
.
Returns
OrcaSynthesizeParams
: An instance ofOrcaSynthesizeParams
.
Throws
OrcaInvalidArgumentException
: If there is an invalid parameter.
OrcaSynthesizeParams.Builder.setSpeechRate()
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.
OrcaException
Exception thrown if an error occurs within Orca Text-to-Speech engine.
Exceptions: