pub struct TTSWithTimestampsResponse {
pub audio: String,
pub audio_format: String,
pub audio_duration: f64,
pub words: Option<Vec<AlignmentSegmentWord>>,
pub characters: Option<Vec<AlignmentSegmentCharacter>>,
}Expand description
Response from POST /v1/text-to-speech/with-timestamps.
The audio field contains Base64-encoded audio data. Use
audio_bytes to decode it, or
save_audio to write directly to a file.
Call to_srt or
to_vtt to generate subtitle output
from the alignment data.
Fields§
§audio: StringBase64-encoded audio bytes.
audio_format: StringAudio container format (e.g. "wav" or "mp3").
audio_duration: f64Total audio duration in seconds.
words: Option<Vec<AlignmentSegmentWord>>Word-level alignment segments (present when granularity is "word" or
when both granularities are returned).
characters: Option<Vec<AlignmentSegmentCharacter>>Character-level alignment segments (present when granularity is
"char" or when both granularities are returned).
Implementations§
Source§impl TTSWithTimestampsResponse
impl TTSWithTimestampsResponse
Sourcepub fn audio_bytes(&self) -> Result<Vec<u8>>
pub fn audio_bytes(&self) -> Result<Vec<u8>>
Decode the Base64-encoded audio field into raw bytes.
Sourcepub fn save_audio<P: AsRef<Path>>(&self, path: P) -> Result<()>
pub fn save_audio<P: AsRef<Path>>(&self, path: P) -> Result<()>
Decode the audio and write it to path.
Trait Implementations§
Source§impl Clone for TTSWithTimestampsResponse
impl Clone for TTSWithTimestampsResponse
Source§fn clone(&self) -> TTSWithTimestampsResponse
fn clone(&self) -> TTSWithTimestampsResponse
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TTSWithTimestampsResponse
impl Debug for TTSWithTimestampsResponse
Source§impl<'de> Deserialize<'de> for TTSWithTimestampsResponse
impl<'de> Deserialize<'de> for TTSWithTimestampsResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TTSWithTimestampsResponse
impl RefUnwindSafe for TTSWithTimestampsResponse
impl Send for TTSWithTimestampsResponse
impl Sync for TTSWithTimestampsResponse
impl Unpin for TTSWithTimestampsResponse
impl UnsafeUnpin for TTSWithTimestampsResponse
impl UnwindSafe for TTSWithTimestampsResponse
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