Defined in carb/audio/AudioUtils.h

constexpr size_t carb::audio::bytesToFrames(size_t bytes, size_t channels, size_t bps)

converts a byte count to a frame count.

  • bytes[in] the number of bytes to be converted to a frame count. Note that this byte count is expected to be frame aligned. If it is not frame aligned, the return value will be the offset for the frame that includes the requested byte offset.

  • channels[in] the number of channels in the audio data format. This may not be 0.

  • bps[in] the number of bits per sample of audio data. This must be 8, 16, 24, or

    1. This does not properly handle byte offset calculations for compressed audio formats. This may not be 0.


the calculated frame offset that will contain the requested byte offset.