samples()

audmath.samples(duration, sampling_rate)[source]

Duration in samples.

The duration is evenly rounded, after converted to samples.

Parameters
  • duration (float) – duration in s

  • sampling_rate (int) – sampling rate in Hz

Return type

int

Returns

duration in number of samples

Examples

>>> samples(0.5, 10)
5
>>> samples(0.55, 10)
6