Orca Streaming Text-to-Speech
Python Quick Start
Platforms
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Raspberry Pi (3, 4, 5)
Requirements
- Picovoice Account & AccessKey
- Python 3.8+
Picovoice Account & AccessKey
Signup or Login to Picovoice Console to get your AccessKey
.
Make sure to keep your AccessKey
secret.
Quick Start
Setup
Install Python 3 (3.8 or higher).
Install the pvorca Python package using PIP:
Usage
Create an instance of the Orca engine and synthesize speech:
Orca supports two modes of operation: streaming and single synthesis. In the streaming synthesis mode, Orca processes an incoming text stream in real-time and generates audio in parallel. In the single synthesis mode, a complete text is synthesized in a single call to the Orca engine.
Streaming synthesis
To synthesize a text stream, create an Orca.OrcaStream
object and add text chunks to it one-by-one:
The text_generator()
function can be any stream generating text, such as an LLM response.
The Orca.OrcaStream
object buffers input text until there is enough context to generate audio.
If there is not enough text to generate audio, None
is returned.
Once the text stream is complete, call the flush
method to synthesize the remaining text:
When done with streaming text synthesis, the Orca.OrcaStream
object needs to be closed:
Single synthesis
Synthesize speech with a single call to one of the Orca.synthesize
methods:
Free resources used by Orca
:
For more information on our Orca Python SDK, head over to our Orca GitHub repository.
Model File
Orca can synthesize speech with various voices, each of which is characterized by a model file located in the Orca GitHub repository. To create an instance of the engine with a specific voice, use:
and replace ${MODEL_PATH}
with the path to the model file with the desired voice.
Demos
For the Orca Python SDK, we offer a demo application that demonstrates how to use the Text-to-Speech engine.
Setup
Install the pvorcademo Python package using PIP:
This package installs command-line utilities for the Orca Python demos.
Usage
Use the --help
flag to see the usage options for the demos, e.g.:
Streaming synthesis demo
This demo showcases how Orca processes an incoming text stream in real-time and generates audio in parallel. The synthesized audio is played as soon as it is generated.
Single synthesis demo
To synthesize a text and save it to a WAV file, run the following:
For more information on our Orca demo for Python, head over to our GitHub repository.