Skip to main content

estimate_key

Function estimate_key 

Source
pub fn estimate_key(
    hpcp: &[f32],
    assumes_12tet: bool,
    min_correlation: f32,
) -> Result<Option<KeyEstimate>, AudioError>
Expand description

Estimate the musical key of a 12-bin HPCP frame/profile.

  • hpcp: pitch-class profile; must be at least 12 bins (bin 0 = C).
  • assumes_12tet: caller-declared assumption. If false, abstains.
  • min_correlation: acceptance threshold; below it the result is Ok(None) (abstain). A value around 0.6–0.7 is typical for confident keys.

Returns Ok(Some(KeyEstimate)) when a key is proposed, Ok(None) when the function abstains.

§Errors