Defined in carb/audio/AudioUtils.h

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

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.

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


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