Text-to-Speech (TTS) technology converts written text into spoken words, allowing users to listen to digital content such as articles, emails, and eBooks instead of reading them. Text-to-Speech systems can improve accessibility for individuals who are visually impaired, and facilitate multitasking by enabling hands-free consumption of information.
In this article, we'll learn how to automatically synthesize text to speech using Picovoice's Orca Text-to-Speech
Web SDK. The SDK runs on all modern browsers.
Setup
Install SDK
Create a project and install the Orca Text-to-Speech
SDK:
Picovoice Console
Log in to (sign up for) Picovoice Console. It is free, and no credit card is required!
Copy your AccessKey
to the clipboard.
Usage
Model File
Download the Orca Text-to-Speech model for the voice that you prefer, and add it to the project by:
- Either copying the model file to the project's public directory:
(or)
- Create a base64 string of the model using the
pvbase64
script included in the package:
Create an object containing the Orca Text-to-Speech
model options:
Initialization
Create an instance of OrcaWorker
with your Picovoice Console AccessKey
and the orcaModel
variable from the previous step:
Text-to-Speech
Synthesize speech by calling the synthesize
method:
Release resources explicitly when done with Orca Text-to-Speech
:
Explore
The Orca Text-to-Speech Web SDK is open-source
and available on GitHub. Additionally, an open-source text-to-speech web demo based on Orca Text-to-Speech
is available.