pub struct Engine { /* private fields */ }
Expand description
A Pico TTS engine.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn put_text(
&mut self,
utf8_text: impl AsRef<[u8]>,
) -> Result<usize, PicoError>
pub fn put_text( &mut self, utf8_text: impl AsRef<[u8]>, ) -> Result<usize, PicoError>
Sourcepub fn flush(&mut self) -> Result<usize, PicoError>
pub fn flush(&mut self) -> Result<usize, PicoError>
Flushes the TTS engine, forcing speech generation. Equivalent to `self.put_text(“\0”).
Sourcepub fn get_data(
&mut self,
buf: impl AsMut<[i16]>,
) -> Result<(usize, EngineStatus), PicoError>
pub fn get_data( &mut self, buf: impl AsMut<[i16]>, ) -> Result<(usize, EngineStatus), PicoError>
Generates speech audio from the text input via put_text
, outputting to buf
.
Returns either a <number of samples generated, EngineStatus
after stepping> pair (on success) or a
PicoError
(on failure).
Output data is encoded as 16-bit signed PCM, at a sample rate of 16kHz.
buf
should have length <= PICO_INT16_MAX
.
§See
Trait Implementations§
impl Eq for Engine
impl Send for Engine
Auto Trait Implementations§
impl Freeze for Engine
impl !RefUnwindSafe for Engine
impl !Sync for Engine
impl Unpin for Engine
impl !UnwindSafe for Engine
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