[][src]Struct fvad::Fvad

pub struct Fvad { /* fields omitted */ }

Implementations

impl Fvad[src]

pub fn new() -> Option<Self>[src]

Creates and initializes a VAD instance.

Returns:

  • Some(Self) wrapping a pointer to the new VAD instance on success
  • None in case of a memory allocation error

pub fn reset(self)[src]

Reinitializes a VAD instance, clearing all state and resetting mode and sample rate to defaults.

pub fn set_mode(self, mode: Mode) -> Self[src]

Changes the VAD operating ("aggressiveness") mode of a VAD instance.

A more aggressive (higher mode) VAD is more restrictive in reporting speech. Put in other words the probability of being speech when the VAD returns 1 is increased with increasing mode. As a consequence also the missed detection rate goes up. The default mode is Mode::Quality.

pub fn set_sample_rate(self, sample_rate: SampleRate) -> Self[src]

Sets the input sample rate in Hz for a VAD instance.

Note that internally all processing will be done 8000 Hz; input data in higher sample rates will just be downsampled first.

pub fn is_voice_frame(&mut self, frame: &[i16]) -> Option<bool>[src]

Calculates a VAD decision for an audio frame.

frame is a slice of signed 16-bit samples. Only slices with a length of 10, 20 or 30 ms are supported, so for example at 8 kHz, frame.len() must be either 80, 160 or 240.

Returns:

  • Some(true) on active voice detection
  • Some(false) on no active voice detection
  • None on invalid frame length

Trait Implementations

impl Drop for Fvad[src]

impl From<*mut Fvad> for Fvad[src]

impl Send for Fvad[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.