Orca Streaming Text-to-Speech
Web API
API Reference for the Orca Web SDK (orca-web)
Orca
Class for the Orca Streaming Text-to-Speech engine.
Orca.create()
Creates an instance of Orca Streaming 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
accessKeystring : AccessKey obtained from Picovoice Console.modelOrcaModel : Orca model options.
Returns
Orca: An instance of the Orca engine.
Orca.synthesize()
Generates audio from text. The returned result contains the speech representation of the text.
Parameters
textstring : 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}".synthesizeParamsOrcaSynthesizeParams : Optional configuration arguments.
Returns
OrcaSynthesizeResult: An Orca synthesize result object.
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.
Orca.streamOpen()
Opens a stream for streaming text synthesis.
Parameters
synthesizeParamsOrcaSynthesizeParams : Optional configuration arguments.
Returns
OrcaStream: An OrcaStream object.
OrcaStream
Class for handling input text streaming synthesis.
OrcaStream.synthesize()
Adds a chunk of text to the 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 the OrcaStream.flush() method to generate the audio
chunk for the remaining text that has not yet been synthesized.
Parameters
textstring : Text to be converted to audio. For details seeOrca.synthesize().
Returns
OrcaStreamSynthesizeResult: OrcaStream synthesize result.
OrcaStream.flush()
Generates audio for all the buffered text that was added to the OrcaStream object
via OrcaStream.synthesize(). This function should be called when there is no more text to be added
to the stream.
Returns
OrcaStreamSynthesizeResult: OrcaStream synthesize result.
OrcaStream.close()
Closes the OrcaStream object and releases resources acquired by the Orca Web SDK.
OrcaModel
Orca model type.
base64string: The model file (.pv) in base64 string to initialize Orca.publicPathstring: The model file (.pv) path relative to the public directory.customWritePathstring : Custom path to save the model in storage. Set to a different name to use multiple models acrossorcainstances.forceWriteboolean : Flag to overwrite the model in storage even if it exists.versionnumber : Version of the model file. Increment to update the model file in storage.
OrcaSynthesizeParams
Orca Synthesize params type.
speechRatenumber : 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.randomStatenumber : Optional configuration to set the random state for sampling during synthesis. This can be used to ensure that the synthesized speech is deterministic across different runs. Valid values are all non-negative integers. If not provided, a random seed will be chosen and the synthesis process will be non-deterministic.
OrcaSynthesizeResult
Orca synthesize result type.
pcmInt16Array : The output audio, represented as a 16-bit linearly-encoded integer array.alignmentsOrcaAlignment[] : Orca alignments.
OrcaAlignment
Orca word alignment type.
wordstring : Synthesized word.startSecnumber : Start time of the word in seconds.endSecnumber : End time of the word in seconds.phonemesOrcaPhoneme[] : Orca phonemes.
OrcaPhoneme
Orca phoneme alignment type.
wordstring : Synthesized phoneme.startSecnumber : Start time of the phoneme in seconds.endSecnumber : End time of the phoneme in seconds.
OrcaStreamSynthesizeResult
OrcaStream synthesize result type.
This value will be either the generated audio as a sequence of 16-bit linearly-encoded integers, or null if no audio chunk has been produced.
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
accessKeystring : AccessKey obtained from Picovoice Console.modelOrcaModel : Orca model options.
Returns
OrcaWorker: An instance ofOrcaWorker.
OrcaWorker.synthesize()
Generates audio from text. The returned result contains the speech representation of the text.
Parameters
textstring : Text to be converted to audio. For details seeOrca.synthesize().synthesizeParamsOrcaSynthesizeParams : Optional configuration arguments.
Returns
OrcaSynthesizeResult: An Orca synthesize result object.
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.
OrcaWorker.streamOpen()
Opens a stream for streaming text synthesis.
Parameters
synthesizeParamsOrcaSynthesizeParams : Optional configuration arguments.
Returns
OrcaStreamWorker: An instance ofOrcaStreamWorker.
OrcaStreamWorker
A class for creating new instances of the OrcaStreamWorker.
OrcaStreamWorker.synthesize()
See OrcaStream.synthesize() for details.
Parameters
textstring : Text to be converted to audio. For details seeOrca.synthesize().
Returns
OrcaStreamSynthesizeResult: OrcaStream synthesize result.
OrcaStreamWorker.flush()
See OrcaStream.flush() for details.
Returns
OrcaStreamSynthesizeResult: OrcaStream synthesize result.
OrcaStreamWorker.close()
See OrcaStream.close() for details.