Orca Streaming Text-to-Speech
Node.js Quick Start
Platforms
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Raspberry Pi (3, 4, 5)
Requirements
- Picovoice Account & AccessKey
- Node.js 16+
- npm
Picovoice Account & AccessKey
Signup or Login to Picovoice Console to get your AccessKey
.
Make sure to keep your AccessKey
secret.
Quick Start
Setup
Usage
Create an instance of the Orca engine:
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 OrcaStream
object and add text chunks to it one-by-one:
The textGenerator()
function can be any stream generating text, such as an LLM response.
The OrcaStream
object buffers input text until there is enough context to generate audio.
If there is not enough text to generate audio, null
is returned.
Once the text stream is complete, call the flush
method to synthesize the remaining text:
When done with streaming text synthesis, the 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 Streaming Text-to-Speech
:
Model File
Orca can synthesize speech with various voices, each of which is characterized by a model file located in the Orca GitHub repository.
Pass in the .pv
file via the modelPath
parameter in the options
argument of the Orca Streaming Text-to-Speech constructor:
Demos
For the Orca Streaming Text-to-Speech Node.js SDK, we offer a demo application that demonstrates how to use the Text-to-Speech engine.
Setup
Install the Orca Streaming Text-to-Speech demo package:
This package installs command-line utilities for the Orca Streaming Text-to-Speech Node.js demos.
Usage
Use the --help
flag to see the usage options for the demo:
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 text and save it to a WAV file, run the following:
For more information on our Orca Streaming Text-to-Speech demos for Node.js, head over to our GitHub repository.
Resources
Packages
API
GitHub
- Orca Streaming Text-to-Speech Node.js SDK on GitHub
- Orca Streaming Text-to-Speech Node.js Demos on GitHub