Package ai.picovoice.orca
Class Orca
- java.lang.Object
-
- ai.picovoice.orca.Orca
-
public class Orca extends java.lang.ObjectAndroid binding for Orca Text-to-Speech engine. Orca converts text to spoken audio without network latency.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOrca.BuilderBuilder for creating instance of Orca.classOrca.OrcaStreamOrcaStream object that converts a stream of text to a stream of audio.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddelete()Releases resources acquired by Orca.intgetMaxCharacterLimit()Getter for the maximum number of characters that can be synthesized at once.intgetSampleRate()Getter for the audio sampling rate of the audio produced by Orca.java.lang.String[]getValidCharacters()Getter for the set of characters that are accepted as input to Orca synthesize functions.java.lang.StringgetVersion()Getter for version.static voidsetSdk(java.lang.String sdk)Orca.OrcaStreamstreamOpen(OrcaSynthesizeParams params)OrcaAudiosynthesize(java.lang.String text, OrcaSynthesizeParams params)Generates audio from text.OrcaWord[]synthesizeToFile(java.lang.String text, java.lang.String outputPath, OrcaSynthesizeParams params)Generates audio from text and saves it to a file.
-
-
-
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.
-
streamOpen
public Orca.OrcaStream streamOpen(OrcaSynthesizeParams params) throws OrcaException
- Parameters:
params- Global parameters for synthesized text. See 'OrcaSynthesizeParams' for details.- Returns:
- OrcaStream object.
- Throws:
OrcaException- if there is an error while opening OrcaStream.
-
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.
-
-