### Get TypeId of Self Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Returns the `TypeId` of the current instance. This is part of the `Any` trait implementation. ```rust fn type_id(&self) -> TypeId ``` -------------------------------- ### Detector Initialization and Prediction Source: https://docs.rs/earshot/1.0.0/earshot/struct.Detector.html This section details how to initialize the Detector and use its prediction methods. ```APIDOC ## Detector Struct ### Summary ```rust pub struct Detector

{ /* private fields */ } ``` ## Implementations ### impl Detector

#### pub fn new(predictor: P) -> Self Initializes a new Detector with the given predictor. #### pub fn reset(&mut self) Resets the internal state of the voice activity detector. The detector should be reset whenever: * the recording device changes; or * the detector is being used for a new audio sequence. #### pub fn predict_i16(&mut self, frame: &[i16]) -> f32 Predicts the voice activity score of a single input frame of 16-bit PCM audio. The frame: * should be sampled at 16 KHz; * should be exactly 256 samples (so 16 ms) in length. The output score is between `[0, 1]`. Scores over 0.5 can generally be considered voice, but the exact threshold can be adjusted according to application-specific needs. #### pub fn predict_f32(&mut self, frame: &[f32]) -> f32 Predicts the voice activity score of a single input frame of 32-bit floating-point PCM audio. The frame: * should be sampled at 16 KHz; * should be exactly 256 samples (so 16 ms) in length; * should consist only of samples in the range [-1, 1]. The output score is between `[0, 1]`. Scores over 0.5 can generally be considered voice, but the exact threshold can be adjusted according to application-specific needs. ``` -------------------------------- ### Detector Methods Source: https://docs.rs/earshot/1.0.0/earshot/struct.Detector.html Methods for initializing, resetting, and performing voice activity prediction on audio frames. ```rust pub fn new(predictor: P) -> Self ``` ```rust pub fn reset(&mut self) ``` ```rust pub fn predict_i16(&mut self, frame: &[i16]) -> f32 ``` ```rust pub fn predict_f32(&mut self, frame: &[f32]) -> f32 ``` -------------------------------- ### DefaultPredictor::new Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Constructor for the DefaultPredictor struct. ```APIDOC ## DefaultPredictor::new ### Description Creates a new instance of the DefaultPredictor struct. ### Method Constructor ### Response - **Self** (struct) - A new instance of DefaultPredictor. ``` -------------------------------- ### Convert From T to T Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Returns the argument unchanged. This is the implementation of `From` for `T`. ```rust fn from(t: T) -> T ``` -------------------------------- ### Instantiate DefaultPredictor Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Creates a new instance of DefaultPredictor. This is the constructor for the struct. ```rust pub fn new() -> Self ``` -------------------------------- ### Try Convert U to T Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Performs the conversion from `U` to `T`. The `Error` type is `Infallible`. ```rust fn try_from(value: U) -> Result>::Error> ``` -------------------------------- ### Try Convert T to U Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Performs the conversion from `T` to `U`. The `Error` type is determined by the `TryFrom` for `U` implementation. ```rust fn try_into(self) -> Result>::Error> ``` -------------------------------- ### Convert From T to U Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Calls `U::from(self)`. The conversion behavior is determined by the `From` for `U` implementation. ```rust fn into(self) -> U ``` -------------------------------- ### Detector Struct Definition Source: https://docs.rs/earshot/1.0.0/earshot/struct.Detector.html The primary structure for voice activity detection, parameterized by a predictor type. ```rust pub struct Detector

{ /* private fields */ } ``` -------------------------------- ### Define the Predictor trait Source: https://docs.rs/earshot/1.0.0/earshot/trait.Predictor.html The base trait definition for implementing custom predictors. Note that this API is unstable and subject to change. ```rust pub trait Predictor { } ``` -------------------------------- ### Immutably Borrow Self Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Provides an immutable reference to the owned value. This is part of the `Borrow` trait implementation. ```rust fn borrow(&self) -> &T ``` -------------------------------- ### Mutably Borrow Self Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Provides a mutable reference to the owned value. This is part of the `BorrowMut` trait implementation. ```rust fn borrow_mut(&mut self) -> &mut T ``` -------------------------------- ### Declare DefaultPredictor Struct Source: https://docs.rs/earshot/1.0.0/earshot/struct.DefaultPredictor.html Defines the DefaultPredictor struct. It has private fields and is intended for internal use. ```rust pub struct DefaultPredictor { /* private fields */ } ``` -------------------------------- ### Predictor Trait Definition Source: https://docs.rs/earshot/1.0.0/earshot/trait.Predictor.html Documentation for the Predictor trait used in VAD score calculation. ```APIDOC ## Trait: Predictor ### Description Used by `Detector` to predict the VAD score of a frame based on extracted features. ### Stability This API is unstable and subject to change. ### Implementors - `DefaultPredictor` ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.