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
use AudioFrame;
use crateTtsError;
use crate;
/// Batch TTS backend: text in, `AudioFrame<'static>` out.
///
/// Every backend must implement this trait. The output `AudioFrame` carries
/// its native sample rate (e.g. 24000 for Kokoro, 24000 for Edge-TTS).
/// Callers should check `frame.sample_rate()` and resample if needed.
///
/// # Example
///
/// ```ignore
/// use wavekat_tts::{TtsBackend, SynthesizeRequest};
///
/// let tts = SomeBackend::new()?;
/// let request = SynthesizeRequest::new("Hello, world");
/// let audio = tts.synthesize(&request)?;
///
/// println!("Generated {} samples at {} Hz ({:.2}s)",
/// audio.len(), audio.sample_rate(), audio.duration_secs());
/// ```
/// Streaming TTS backend: text in, `AudioFrame<'static>` chunks out.
///
/// Extends [`TtsBackend`] with streaming support. Each chunk is a
/// self-contained `AudioFrame` that can be played or forwarded immediately.