Skip to main content

StreamingTtsBackend

Trait StreamingTtsBackend 

Source
pub trait StreamingTtsBackend: TtsBackend {
    // Required method
    fn stream(
        &self,
        request: &SynthesizeRequest<'_>,
    ) -> Result<Box<dyn Iterator<Item = Result<AudioFrame<'static>, TtsError>> + Send>, TtsError>;
}
Expand description

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.

Required Methods§

Source

fn stream( &self, request: &SynthesizeRequest<'_>, ) -> Result<Box<dyn Iterator<Item = Result<AudioFrame<'static>, TtsError>> + Send>, TtsError>

Start streaming synthesis.

Returns an iterator of audio chunks. Each chunk is an owned AudioFrame at the backend’s native sample rate. The last chunk can be detected by checking the iterator exhaustion.

Implementors§