Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::millisecondsToBytes(size_t timeInMilliseconds, size_t frameRate, size_t channels, size_t bps)

converts a time in milliseconds to a byte count.

  • timeInMilliseconds[in] the time in milliseconds to be converted to a frame count.

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

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

  • bps[in] the number of bits per sample of audio data. This must be 8, 16, 24, or 32. This does not properly handle byte offset calculations for compressed audio formats.


the approximate number of bytes of audio data required to fill the requested number of milliseconds. Note that this will not be an exact value because the data format may not divide evenly into the requested number of milliseconds.