Trait TtsProvider
pub trait TtsProvider:
Send
+ Sync
+ Attributable {
// Required methods
fn name(&self) -> &str;
fn synthesize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn output_format(&self) -> &str;
fn supported_voices(&self) -> Vec<String>;
fn supported_formats(&self) -> Vec<String>;
}Expand description
Trait for pluggable TTS backends.
Required Methods§
Sourcefn synthesize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn synthesize<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
text: &'life1 str,
voice: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Synthesize text using the given voice, returning raw audio bytes.
Sourcefn output_format(&self) -> &str
fn output_format(&self) -> &str
The audio container/format of the bytes returned by
synthesize (e.g. "opus", "wav", "mp3").
Channels use this to pick the correct upload MIME type and Telegram
send method — only opus/ogg is a true voice note.
Sourcefn supported_voices(&self) -> Vec<String>
fn supported_voices(&self) -> Vec<String>
Voices supported by this model_provider.
Sourcefn supported_formats(&self) -> Vec<String>
fn supported_formats(&self) -> Vec<String>
Audio output formats supported by this model_provider.