Orca Streaming Text-to-Speech
.NET Quick Start
Platforms
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64, arm64)
- Raspberry Pi (3, 4, 5)
Requirements
.NET Framework 4.6.1+ / .NET Standard 2.0+ / .NET Core 3.0+:
- Windows (x86_64)
.NET Standard 2.0+ / .NET Core 3.0+:
- macOS (x86_64)
.NET 6.0+:
- macOS (arm64)
- Windows (arm64)
- Linux (x86_64)
- Raspberry Pi (3, 4)
Picovoice Account & AccessKey
Signup or Login to Picovoice Console to get your AccessKey
.
Make sure to keep your AccessKey
secret.
Quick Start
Setup
Install .NET.
Install the Orca Text-to-Speech NuGet package in Visual Studio or using the .NET CLI:
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 Orca.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 Orca.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:
OrcaStream
implements IDisposable
, so you either call .Dispose()
to close it or wrap it in a using statement:
Single synthesis
Synthesize speech with a single call to one of the Orca.Synthesize
methods:
Orca
will have its resources freed by the garbage collector, but to have resources freed immediately after use,
wrap it in a using statement:
For more information on our Orca .NET 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 .NET SDK, we offer a demo application that demonstrates how to use the Text-to-Speech engine.
Setup
- Clone the Orca Text-to-Speech repository from GitHub:
- Build the 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 .NET, head over to our GitHub repository.