seconds_to_samples

Function seconds_to_samples 

Source
pub fn seconds_to_samples<F: RealFloat>(
    seconds: F,
    sample_rate: impl Into<u32>,
) -> usize
Expand description

Helper function to convert seconds to samples Converts time in seconds to number of samples at given sample rate

§Arguments

  • seconds: Duration in seconds
  • sample_rate: Sampling frequency in Hz (accepts u32 or NonZeroU32)

§Returns

Number of samples representing the specified duration

§Panics

Panics if the computed sample count cannot be converted to usize, typically when the result would overflow or is infinite/NaN.