1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
//! # kothok-edge-tts
//!
//! A Microsoft Edge online text-to-speech client for Rust.
//!
//! Replicates the Edge browser **Read Aloud** WebSocket protocol against
//! `speech.platform.bing.com`, including the rotating `Sec-MS-GEC` DRM token.
//! Returns the same neural voices the browser uses (e.g.
//! `en-US-EmmaMultilingualNeural`, `bn-BD-NabanitaNeural`) as streaming MP3
//! frames plus word-boundary metadata for highlighting.
//!
//! ## Quick start
//!
//! ```no_run
//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
//! use kothok_edge_tts::Engine;
//! kothok_edge_tts::init_tls(); // once, before the first connect
//! let events = kothok_edge_tts::EdgeTts
//! .synthesize("Hello world.", "en-US-EmmaMultilingualNeural", "+0%", "en-US")
//! .await?;
//! # Ok(()) }
//! ```
//!
//! ## Architecture
//!
//! | Module | Responsibility |
//! |---------------|---------------------------------------------------------|
//! | [`Engine`] | Swappable TTS-backend trait (mock or replace Edge). |
//! | [`EdgeTts`] | Reference `Engine` impl — orchestrates a synthesis turn.|
//! | [`TtsEvent`] | Streaming events: audio chunks, word boundaries, end. |
//! | [`TtsError`] | Crate-level error enum. |
//!
//! Internal modules (`auth`, `connection`, `protocol`, `ssml`) are crate-private.
//!
//! > **Note:** this uses the *undocumented* consumer endpoint that Edge's Read
//! > Aloud feature targets. Microsoft can rotate the `SEC_MS_GEC_VERSION`
//! > constant (it 403s when stale); re-pin it and republish when that happens.
pub use EdgeTts;
pub use TtsError;
pub use TtsEvent;
pub use Engine;
/// Install rustls's `ring` crypto provider.
///
/// rustls 0.23 requires an explicit crypto provider before any TLS handshake.
/// Call this **once** at startup, before the first [`EdgeTts`] connect.
/// Idempotent — safe to call multiple times.