Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Read aloud
A cross-platform text-to-speech library with C interface, written in Rust.
It reverse-engineers the awesome Microsoft Edge Read aloud feature, allowing you to use it in your own projects in your preferred programming language.
Read aloud is a low-level library that is designed as a building block for higher-level text-to-speech libraries and applications.
Edge service compatibility
This crate counterfeits the communication protocol used by Microsoft Edge to work with the Read Aloud service. Any change to the upstream Edge service can break the crate, even if the public C ABI stays the same. If the service updates its protocol, authentication, or required headers, the library may need internal changes to restore functionality.
Build requirements
This library connects to the Edge read-aloud service over secure WebSockets. TLS support is currently provided by tungstenite with its native-tls feature enabled.
On Linux, native-tls uses the system OpenSSL installation, so building this crate requires OpenSSL development files and pkg-config to be installed.
For Debian or Ubuntu:
On Windows and macOS, native-tls uses the platform TLS stack instead of OpenSSL, so this Linux-specific package installation is usually not required.
API
The library exposes both a Rust API and a C ABI for text-to-speech generation.
Rust API
use Path;
use ;
let options = SpeechOptions ;
text_to_speech?;
SpeechOptions::default() uses the service defaults for pitch, rate, and volume.
C API
The C ABI uses a size-prefixed options struct so the parameter surface can evolve without redesigning the function signature.
typedef struct ReadAloudSpeechOptions ReadAloudSpeechOptions;
// Initialize an options struct with library defaults.
enum ReadAloudStatus ;
// Generate speech audio from text and save to a file. Pass NULL for default options.
enum ReadAloudStatus ;
// Get a short static description for a status code.
const char *;
// Get a detailed error message for the last failure on the calling thread.
const char *;
read_aloud_text_to_speech returns a numeric status code.
Passing NULL for options uses the default pitch, rate, and volume.
read_aloud_speech_options_init fills a caller-provided options struct and sets its size field for the current ABI.
read_aloud_status_string returns a short static description for that code.
read_aloud_last_error_message returns a more detailed, thread-local message describing the last failure on the calling thread. The pointer remains valid until the next library call on the same thread.
Parameters
pitch_hz is specified in Hz.
rate must be between -1.0 and 1.0, where 0.0 is the default voice speed.
volume must be between -1.0 and 1.0, where 0.0 is the default voice volume.
Error codes
The function returns 0 on success, and a non-zero error code on failure:
Supported languages and voices
Examples
// Load the read_aloud shared library and resolve the exported symbols before running this example.
int
use Path;
use ;
// Load the read_aloud shared library and resolve the exported symbols before running this example.
int
# Load the read_aloud shared library before running this example.
# Assume `lib` is an already-loaded ctypes.CDLL instance.
=
=
=
=
=
=
=
=
=
= 110 # en_GB_ThomasNeural
=
=
=
=
=