Orca Text-to-Speech
Web API
API Reference for the Orca Web SDK (orca-web)
Orca
Class for the Orca Text-to-Speech engine.
Orca.create()
Creates an instance of Orca Text-to-Speech engine using '.pv' file in public directory. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.model
OrcaModel : Orca model options.
Returns
Orca
: An instance of the Orca engine.
Orca.synthesize()
Generates audio from text. The returned audio contains the speech representation of the text.
Parameters
text
string : Text to be converted to audio. The maximum number of characters per call is.maxCharacterLimit
. The complete list of allowed characters can be retrieved with.validCharacters
. Custom pronunciations can be embedded in the text via the syntax "{word|pronunciation}". The pronunciation is expressed in ARPAbet phonemes, for example: "{read|R IY D} this as {read|R EH D}".synthesizeParams
SynthesizeParams : Optional configuration arguments.
Returns
Int16Array
: The output audio, represented as a 16-bit linearly-encoded integer array.
Orca.release()
Releases resources acquired by the Orca Web SDK.
Orca.sampleRate
Audio sample rate of the synthesized speech.
Orca.maxCharacterLimit
Maximum number of characters accepted by Orca in one .synthesize()
call.
Orca.validCharacters
Valid characters accepted by Orca.
Orca.version
Orca version string.
OrcaModel
Orca model type.
base64
string: The model file (.pv
) in base64 string to initialize Orca.publicPath
string: The model file (.pv
) path relative to the public directory.customWritePath
string : Custom path to save the model in storage. Set to a different name to use multiple models acrossorca
instances.forceWrite
boolean : Flag to overwrite the model in storage even if it exists.version
number : Version of the model file. Increment to update the model file in storage.
SynthesizeParams
Synthesize params type.
speechRate
number : Optional configuration to control the speed of the generated speech. Valid values are within [0.7, 1.3]. A higher value produces speech that is faster, and a lower value produces speech that is slower. The default is1.0
.
OrcaWorker
A class for creating new instances of the OrcaWorker
.
OrcaWorker.create()
Creates an instance of OrcaWorker
using '.pv' file in public directory. The model size is large, hence it will try to use the existing one if it exists, otherwise saves the model in storage.
Parameters
accessKey
string : AccessKey obtained from Picovoice Console.model
OrcaModel : Orca model options.
Returns
OrcaWorker
: An instance ofOrcaWorker
.
OrcaWorker.synthesize()
Generates audio from text. The returned audio contains the speech representation of the text.
Parameters
text
string : Text to be converted to audio. The maximum number of characters per call is.maxCharacterLimit
. Allowed characters are lower-case and upper-case letters and punctuation marks that can be retrieved with.validCharacters
. Custom pronunciations can be embedded in the text via the syntax "{word|pronunciation}". The pronunciation is expressed in ARPAbet phonemes, for example: "{read|R IY D} this as {read|R EH D}".synthesizeParams
SynthesizeParams : Optional configuration arguments.
Returns
Int16Array
: The output audio, represented as a 16-bit linearly-encoded integer array.
OrcaWorker.release()
Releases resources acquired by the Orca Web SDK.
OrcaWorker.terminate()
Force terminates the instance of OrcaWorker
.
OrcaWorker.sampleRate
Audio sample rate of the synthesized speech.
OrcaWorker.maxCharacterLimit
Maximum number of characters accepted by Orca in one .synthesize()
call.
OrcaWorker.validCharacters
Valid characters accepted by Orca.
OrcaWorker.version
Orca version string.