askvity

What is Audio Frame Size?

Published in Audio Concepts 2 mins read

Audio frame size refers to the amount of data representing a single point in time for all channels within an audio stream.

In digital audio processing, sound is divided into small segments or frames for easier handling. The size of an audio frame is typically measured in bytes and is fundamental to understanding how much data is processed at once.

Based on the reference provided, the specific calculation for determining the size of an audio frame is:

The size in bytes of an audio frame equals the number of channels in the stream multiplied by the sample size per channel.

Let's break down the components of this definition:

  • Number of Channels: This indicates how many individual audio streams are present in the signal (e.g., 1 for mono, 2 for stereo, 5.1 for surround sound).
  • Sample Size per Channel: Also known as bit depth, this is the number of bits used to represent the amplitude of the audio signal at a single point in time for one channel (e.g., 8-bit, 16-bit, 24-bit). Since the frame size is typically given in bytes, the sample size in bits must be converted to bytes (1 byte = 8 bits).

Calculating Audio Frame Size

To calculate the frame size in bytes, you use the formula:

Audio Frame Size (Bytes) = Number of Channels × (Sample Size (Bits) / 8)

Example Calculation

Using the example from the reference:

  • Scenario: A stereo (2-channel) audio stream with 16-bit samples.
  • Number of Channels: 2
  • Sample Size (Bits): 16 bits
  • Sample Size (Bytes): 16 bits / 8 bits/byte = 2 bytes

Applying the formula:

Audio Frame Size = 2 channels × 2 bytes/channel
Audio Frame Size = 4 bytes

As stated in the reference, the frame size is indeed four bytes for this configuration.

Here are a few more examples:

Number of Channels Sample Size (Bits) Sample Size (Bytes) Audio Frame Size (Bytes)
1 (Mono) 16 2 1 × 2 = 2
2 (Stereo) 16 2 2 × 2 = 4
2 (Stereo) 24 3 2 × 3 = 6
6 (5.1 Surround) 16 2 6 × 2 = 12

Knowing the audio frame size is important in digital audio for tasks such as:

  • Buffering audio data
  • Processing samples across all channels simultaneously
  • Calculating data rates (frame size × sample rate = bytes per second)

Related Articles