Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::bytesToMilliseconds(size_t bytes, size_t frameRate, size_t channels, SampleFormat format)

converts a byte count to an approximate time in milliseconds.

  • bytes[in] the number of bytes to be converted to a time in milliseconds. Note that this byte count is expected to be frame aligned.

  • frameRate[in] the frame rate of the audio that needs a time calculated.

  • channels[in] the number of channels in the audio data format.

  • format[in] the sample format of the data. This must be a PCM sample format.


the approximate number of milliseconds of audio data that the requested byte count represents for the given format.