SpeakStream
____ _ ____ _
/ ___| _ __ ___ __ _| | __/ ___|| |_ _ __ ___ __ _ _ __ ___
\___ \| '_ \ / _ \/ _` | |/ /\___ \| __| '__/ _ \/ _` | '_ ` _ \
___) | |_) | __/ (_| | < ___) | |_| | | __/ (_| | | | | | |
|____/| .__/ \___|\__,_|_|\_\|____/ \__|_| \___|\__,_|_| |_| |_|
|_|
A streaming text-to-speech library built on OpenAI's API. Feed tokens as they arrive and hear them spoken back in real time.
Features
- ð§ Sentence-aware streaming turns tokens into speech as soon as sentences are complete.
- ðĶĒ Optional audio ducking lowers other application volumes while speech plays and can be toggled at runtime.
- ðĢïļ Change voices easily using OpenAI's voice models.
- âĐ Adjust playback speed on the fly.
- ð Mute/unmute or stop speech instantly.
- ð Automatic output device switching with
DefaultDeviceSink. - â Tick and error sounds for progress and failures.
Setup
Add SpeakStream to your Cargo.toml:
[]
= { = "path/to/speakstream" }
Then build the library:
Example
use SpeakStream;
use Voice;
async
Runtime audio ducking
Audio ducking can be enabled when creating a new stream or toggled at runtime:
let mut speak = new_with_ducking;
assert!;
speak.set_audio_ducking_enabled;
License
MIT