pub struct VoiceService { /* private fields */ }Expand description
One speak and one listen server at a time, each owned or attached.
Implementations§
Source§impl VoiceService
impl VoiceService
pub fn new(home: &Path) -> Result<Self, VoiceError>
pub fn status(&self) -> Vec<SlotView>
pub fn stop(&self, kind: VoiceKind) -> bool
pub fn shutdown(&self)
Sourcepub async fn attach(
&self,
kind: VoiceKind,
endpoint: &str,
model: &str,
) -> Result<(), VoiceError>
pub async fn attach( &self, kind: VoiceKind, endpoint: &str, model: &str, ) -> Result<(), VoiceError>
Uses a voice server someone else runs on loopback, speaking OpenAI’s audio API.
Sourcepub fn start(
self: &Arc<Self>,
model: &VoiceModel,
hardware: &Hardware,
parent: &CancellationToken,
) -> Result<(), VoiceError>
pub fn start( self: &Arc<Self>, model: &VoiceModel, hardware: &Hardware, parent: &CancellationToken, ) -> Result<(), VoiceError>
Starts model’s engine in the background; status reports its progress.
Sourcepub async fn speak(
&self,
request: &SpeakRequest,
catalog: &VoiceCatalog,
cancel: &CancellationToken,
) -> Result<Vec<u8>, VoiceError>
pub async fn speak( &self, request: &SpeakRequest, catalog: &VoiceCatalog, cancel: &CancellationToken, ) -> Result<Vec<u8>, VoiceError>
Text to WAV with the running speak model.
Sourcepub async fn transcribe(
&self,
audio: &[u8],
language: Option<&str>,
cancel: &CancellationToken,
) -> Result<String, VoiceError>
pub async fn transcribe( &self, audio: &[u8], language: Option<&str>, cancel: &CancellationToken, ) -> Result<String, VoiceError>
WAV to text with the running listen model.
Trait Implementations§
Source§impl Drop for VoiceService
impl Drop for VoiceService
Auto Trait Implementations§
impl !Freeze for VoiceService
impl !RefUnwindSafe for VoiceService
impl !UnwindSafe for VoiceService
impl Forget for VoiceService
impl Send for VoiceService
impl Sync for VoiceService
impl Unpin for VoiceService
impl UnsafeUnpin for VoiceService
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