Picovoice Wordmark
Start Building
Introduction
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryPicovoice picoLLMGPTQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice LeopardAmazon TranscribeAzure Speech-to-TextGoogle ASRGoogle ASR (Enhanced)IBM Watson Speech-to-TextWhisper Speech-to-Text
FAQ
Introduction
AndroidC.NETFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustWeb
SummaryPicovoice Cheetah
FAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidC.NETiOSNode.jsPythonWeb
SummaryAmazon PollyAzure TTSElevenLabsOpenAI TTSPicovoice Orca
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice KoalaMozilla RNNoise
Introduction
AndroidCiOSLinuxmacOSNode.jsPythonRaspberry PiWebWindows
AndroidCNode.jsPythoniOSWeb
SummaryPicovoice EaglepyannoteSpeechBrainWeSpeaker
Introduction
AndroidCiOSLinuxmacOSPythonRaspberry PiWebWindows
AndroidCiOSPythonWeb
SummaryPicovoice FalconAmazon TranscribeAzure Speech-to-TextGoogle Speech-to-Textpyannote
Introduction
AndroidArduinoCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSMicrocontrollerNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaMicrocontrollerNode.jsPythonReactReact NativeRustUnityWeb
SummaryPorcupineSnowboyPocketSphinx
Wake Word TipsFAQ
Introduction
AndroidCChrome.NETEdgeFirefoxFlutteriOSJavaLinuxmacOSNode.jsPythonRaspberry PiReactReact NativeRustSafariUnityWebWindows
AndroidC.NETFlutteriOSJavaNode.jsPythonReactReact NativeRustUnityWeb
SummaryPicovoice RhinoGoogle DialogflowAmazon LexIBM WatsonMicrosoft LUIS
Expression SyntaxFAQ
Introduction
AndroidC.NETiOSLinuxmacOSNode.jsPythonRaspberry PiRustWebWindows
AndroidC.NETiOSNode.jsPythonRustWeb
SummaryPicovoice CobraWebRTC VAD
FAQ
Introduction
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
AndroidC.NETFlutteriOSNode.jsPythonReact NativeRustUnityWeb
Introduction
C.NETNode.jsPython
C.NETNode.jsPython
FAQGlossary

Orca Streaming Text-to-Speech
Node.js Quick Start

Platforms

  • Linux (x86_64)
  • macOS (x86_64, arm64)
  • Windows (x86_64, arm64)
  • Raspberry Pi (3, 4, 5)

Requirements

  • Picovoice Account & AccessKey
  • Node.js 18+
  • npm

Picovoice Account & AccessKey

Signup or Login to Picovoice Console to get your AccessKey. Make sure to keep your AccessKey secret.

Quick Start

Setup

  1. Install Node.js.

  2. Install the orca-node npm package:

npm install @picovoice/orca-node

Usage

Create an instance of the Orca engine:

const Orca = require("@picovoice/orca-node");
const accessKey = "${ACCESS_KEY}";
const orca = new Orca(accessKey);

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:

const stream = orca.streamOpen();
for (const textChunk of textGenerator()) {
const pcm = stream.synthesize(textChunk);
if (pcm !== null) {
// handle pcm
}
}

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:

const pcm = stream.flush();
if (pcm !== null) {
// handle pcm
}

When done with streaming text synthesis, the OrcaStream object needs to be closed:

stream.close()

Single synthesis

Synthesize speech with a single call to one of the Orca.synthesize methods:

// Return raw PCM
const { pcm, alignments } = orca.synthesize('${TEXT}')
// Save the generated audio to a WAV file directly
const alignments = orca.synthesizeToFile('${TEXT}', '${WAV_OUTPUT_PATH}')

Free resources used by Orca Streaming Text-to-Speech:

orca.release()

Model File

Orca Streaming Text-to-Speech can synthesize speech in different languages and with a variety of voices, each of which is characterized by a model file (.pv) located in the Orca GitHub repository. The language and gender of the speaker is indicated in the file name.

Pass in the .pv file via the modelPath parameter in the options argument of the Orca Streaming Text-to-Speech constructor:

const orca = new Orca(accessKey, { modelPath: "${MODEL_PATH}"});

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:

npm install -g @picovoice/orca-node-demo

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:

orca-streaming-demo --help

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.

orca-streaming-demo --access_key ${ACCESS_KEY} --text_to_stream ${TEXT_TO_STREAM}

Single synthesis demo

To synthesize text and save it to a WAV file, run the following:

orca-file-demo --access_key ${ACCESS_KEY} --text ${TEXT} --output_path ${OUTPUT_PATH}

For more information on our Orca Streaming Text-to-Speech demos for Node.js, head over to our GitHub repository.

Resources

Packages

  • @picovoice/orca-node on the npm registry
  • @picovoice/orca-node-demo on the npm registry

API

  • @picovoice/orca-node API Docs

GitHub

  • Orca Streaming Text-to-Speech Node.js SDK on GitHub
  • Orca Streaming Text-to-Speech Node.js Demos on GitHub

Benchmark

  • Text-to-Speech Benchmark

Was this doc helpful?

Issue with this doc?

Report a GitHub Issue
Orca Streaming Text-to-Speech Node.js Quick Start
  • Platforms
  • Requirements
  • Picovoice Account & AccessKey
  • Quick Start
  • Setup
  • Usage
  • Model File
  • Demos
  • Setup
  • Usage
  • Resources
Voice AI
  • Leopard Speech-to-Text
  • Cheetah Streaming Speech-to-Text
  • Orca Text-to-Speech
  • Koala Noise Suppression
  • Eagle Speaker Recognition
  • Falcon Speaker Diarization
  • Porcupine Wake Word
  • Rhino Speech-to-Intent
  • Cobra Voice Activity Detection
Local LLM
  • picoLLM Inference
  • picoLLM Compression
  • picoLLM GYM
Resources
  • Docs
  • Console
  • Blog
  • Use Cases
  • Playground
Sales & Services
  • Consulting
  • Foundation Plan
  • Enterprise Plan
  • Enterprise Support
Company
  • About us
  • Careers
Follow Picovoice
  • LinkedIn
  • GitHub
  • X
  • YouTube
  • AngelList
Subscribe to our newsletter
Terms of Use
Privacy Policy
© 2019-2025 Picovoice Inc.