pub struct TextToAudioBody<N>where
N: TextToAudio,{ /* private fields */ }Expand description
Request body for text-to-speech synthesis.
Implementations§
Source§impl<N> TextToAudioBody<N>where
N: TextToAudio,
impl<N> TextToAudioBody<N>where
N: TextToAudio,
Sourcepub fn new(model: N) -> Self
pub fn new(model: N) -> Self
Create a new TTS request body for the given model.
The built-in tongtong voice and documented PCM format are selected.
Sourcepub fn response_format(&self) -> TtsAudioFormat
pub fn response_format(&self) -> TtsAudioFormat
Selected output format.
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Whether this body requests SSE audio chunks.
Sourcepub fn encode_format(&self) -> Option<TtsEncodeFormat>
pub fn encode_format(&self) -> Option<TtsEncodeFormat>
Streaming payload encoding, when streaming is enabled.
Sourcepub fn watermark_enabled(&self) -> Option<bool>
pub fn watermark_enabled(&self) -> Option<bool>
Optional watermark setting.
Sourcepub fn with_input(self, input: impl Into<String>) -> Self
pub fn with_input(self, input: impl Into<String>) -> Self
Set the input text to synthesize.
Sourcepub fn with_voice(self, voice: Voice) -> Self
pub fn with_voice(self, voice: Voice) -> Self
Set the voice preset.
Sourcepub fn with_speed(self, speed: f32) -> Self
pub fn with_speed(self, speed: f32) -> Self
Set the playback speed (0.5–2.0).
Sourcepub fn with_volume(self, volume: f32) -> Self
pub fn with_volume(self, volume: f32) -> Self
Set the playback volume (greater than 0.0 and at most 10.0).
Sourcepub fn with_response_format(self, fmt: TtsAudioFormat) -> Self
pub fn with_response_format(self, fmt: TtsAudioFormat) -> Self
Set the output audio format.
Sourcepub fn with_watermark_enabled(self, enabled: bool) -> Self
pub fn with_watermark_enabled(self, enabled: bool) -> Self
Enable/disable the audio watermark.
Trait Implementations§
Source§impl<N> Clone for TextToAudioBody<N>where
N: TextToAudio + Clone,
impl<N> Clone for TextToAudioBody<N>where
N: TextToAudio + Clone,
Source§fn clone(&self) -> TextToAudioBody<N>
fn clone(&self) -> TextToAudioBody<N>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<N> Debug for TextToAudioBody<N>where
N: TextToAudio + Debug,
impl<N> Debug for TextToAudioBody<N>where
N: TextToAudio + Debug,
Source§impl<N> Serialize for TextToAudioBody<N>where
N: TextToAudio + Serialize,
impl<N> Serialize for TextToAudioBody<N>where
N: TextToAudio + Serialize,
Source§impl<N> Validate for TextToAudioBody<N>where
N: TextToAudio,
impl<N> Validate for TextToAudioBody<N>where
N: TextToAudio,
Source§impl<'v_a, N> ValidateArgs<'v_a> for TextToAudioBody<N>where
N: TextToAudio,
impl<'v_a, N> ValidateArgs<'v_a> for TextToAudioBody<N>where
N: TextToAudio,
Auto Trait Implementations§
impl<N> Freeze for TextToAudioBody<N>where
N: Freeze,
impl<N> RefUnwindSafe for TextToAudioBody<N>where
N: RefUnwindSafe,
impl<N> Send for TextToAudioBody<N>where
N: Send,
impl<N> Sync for TextToAudioBody<N>where
N: Sync,
impl<N> Unpin for TextToAudioBody<N>where
N: Unpin,
impl<N> UnsafeUnpin for TextToAudioBody<N>where
N: UnsafeUnpin,
impl<N> UnwindSafe for TextToAudioBody<N>where
N: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more