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
AudioError::InvalidParameterifsample_rate <= 0, the signal is empty, or it carries no energy.