Orca Streaming Text-to-Speech
Web Quick Start
Platforms
- Chrome & Chromium-based browsers
- Edge
- Firefox
- Safari
Requirements
- Picovoice Account and 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
Install Node.js.
Install the Orca Streaming Text-to-Speech Web package:
Usage
Download the model file for the voice that you prefer.
Put the model file in the project's public directory or generate a base64 model using the built-in script:
Create an OrcaWorker
instance using a base64 model or a model hosted in a public directory:
Orca Streaming Text-to-Speech 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 use streaming synthesis, call streamOpen
to create an OrcaStream
object.
Then, call synthesize
on orcaStream
to generate speech from a stream of text:
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 by calling the synthesize
method:
Release resources
Release resources explicitly when done with Orca:
Demo
For the Orca Streaming Text-to-Speech Web SDK, there is a Web demo project available on the Orca GitHub repository.
Setup
Clone the Orca Streaming Text-to-Speech repository from GitHub:
Usage
- Install dependencies and run:
- Open http://localhost:5000 to view it in the browser.