Function frames_to_time

Source
pub fn frames_to_time(
    frames: &[usize],
    sr: Option<u32>,
    hop_length: Option<usize>,
) -> Vec<f32>
Expand description

Converts frame indices to time values in seconds.

§Arguments

  • frames - Array of frame indices
  • sr - Optional sample rate in Hz (defaults to 44100)
  • hop_length - Optional hop length in samples (defaults to 512)

§Returns

Returns a Vec<f32> containing corresponding time values in seconds.

§Examples

let frames = vec![0, 1, 2];
let times = frames_to_time(&frames, None, None);
assert_eq!(times, vec![0.0, 0.011609977, 0.023219954]); // Approx at 44100 Hz, hop 512