Orca Text-to-Speech
Python API
API Reference for the Python Orca SDK (PyPI).
pvorca.create()
Factory method for Orca Text-to-Speech engine.
Parameters
access_key
str : AccessKey obtained from Picovoice Console.model_path
Optional[str] : Absolute path to the file containing model parameters (.pv
). This file determines the voice of the synthesized speech.library_path
Optional[str] : Absolute path to Orca's dynamic library.
Returns
Orca
: An instance of the Orca Text-to-Speech engine.
Throws
pvorca.Orca
Class for the Orca Text-to-Speech engine.
Orca can be initialized either using the module level create()
function
or directly using the class __init__()
method.
Resources should be cleaned when you are done using the delete()
method.
pvorca.Orca.version
The version string of the Orca library.
pvorca.Orca.valid_characters
The set of valid characters that Orca accepts in the text input to the synthesis methods.
pvorca.Orca.sample_rate
The audio sample rate of the synthesized speech.
pvorca.Orca.max_character_limit
The maximum number of characters allowed in a single synthesis request.
pvorca.Orca.__init__()
__init__
method for Orca Text-to-Speech engine.
Parameters
access_key
str : AccessKey obtained from Picovoice Console.model_path
str : Absolute path to the file containing model parameters (.pv
). This file determines the voice of the synthesized speech.library_path
str : Absolute path to Orca's dynamic library.
Returns
Orca
: An instance of the Orca Text-to-Speech engine.
Throws
pvorca.Orca.delete()
Releases resources acquired by Orca.
pvorca.Orca.synthesize()
Generates audio from text. The returned audio contains the speech representation of the text.
If you wish to save the synthesized speech to a file, consider
using .synthesize_to_file()
.
Parameters
text
str : Text to be converted to audio. The maximum number of characters per call isself.max_character_limit
. Allowed characters can be retrieved by callingself.pv_orca_valid_characters
. 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}".speech_rate
Optional[float] : Speed of generated speech. Valid values are within[0.7, 1.3]
. Higher (lower) values produce faster (slower) speech. The default is1.0
.
Returns
- Sequence[int] : The generated audio, stored as a sequence of 16-bit linearly-encoded integers.
Throws
pvorca.Orca.synthesize_to_file()
Generates audio from text and saves it to a WAV file. The file contains the speech representation of the text.
Parameters
text
str : Text to be converted to audio. For details see the documentation of.synthesize()
.output_path
str : Absolute path to save the generated audio as a single-channel 16-bit PCM WAV file.speech_rate
Optional[float] : Speed of generated speech. For details see the documentation of.synthesize()
.
Throws
pvorca.OrcaError
Error thrown if an error occurs within the Orca
Text-to-Speech engine.
Exceptions