pub struct CrepeHead {
pub state: WeightState,
}Expand description
Learned CREPE pitch head. Fail-closed: Absent state ⇒ inference abstains.
Fields§
§state: WeightStateImplementations§
Source§impl CrepeHead
impl CrepeHead
Sourcepub fn new() -> Self
pub fn new() -> Self
Construct with no weights — fails closed until CrepeHead::load succeeds.
Sourcepub fn load(&mut self, bytes: &[u8]) -> Result<(), AudioError>
pub fn load(&mut self, bytes: &[u8]) -> Result<(), AudioError>
Load weights from a P64 blob (cold path).
Sourcepub fn infer_pitch(
&self,
frame: &[f32],
sample_rate: u32,
) -> Result<f32, AudioError>
pub fn infer_pitch( &self, frame: &[f32], sample_rate: u32, ) -> Result<f32, AudioError>
Estimate fundamental frequency (Hz) from a single frame.
- No weights ⇒
Err(BackendUnavailable)(abstain; no fabricated pitch). sample_ratemust be non-zero, elseInvalidParameter.frame.len()must equal the blob’sframe_len, elseInvalidParameter.
Returns the argmax-bin frequency. Hot path: no allocation.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CrepeHead
impl RefUnwindSafe for CrepeHead
impl Send for CrepeHead
impl Sync for CrepeHead
impl Unpin for CrepeHead
impl UnsafeUnpin for CrepeHead
impl UnwindSafe for CrepeHead
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