Skip to main content

centroid_time

Function centroid_time 

Source
pub fn centroid_time(
    signal: &[f32],
    sample_rate: f32,
) -> Result<f32, AudioError>
Expand description

Temporal centroid of signal in seconds: the energy-weighted mean time sum(t_i * x_i^2) / sum(x_i^2) where t_i = i / sample_rate. This is the time-domain analogue of the spectral centroid — the “balance point” of the signal’s energy along the time axis.

§Errors