AudioStreamBasicDescription
A format specification for an audio stream.
Declaration
struct AudioStreamBasicDescriptionOverview
You can configure an audio stream basic description (ASBD) to specify a linear PCM format or a constant bit rate (CBR) format that has channels of equal size. For variable bit rate (VBR) audio, and for CBR audio where the channels have unequal sizes, also use an AudioStreamPacketDescription structure to additionally describe each packet.
A field value of 0 indicates that the value is either unknown or not applicable to the format.
Always initialize the fields of a new audio stream basic description structure to 0, as the example below shows:
AudioStreamBasicDescription myAudioDataFormat = {0};To determine the duration that one packet represents, use the mSampleRate field with the mFramesPerPacket field, as follows:
duration = (1 / mSampleRate) * mFramesPerPacketIn Core Audio, the following definitions apply:
An audio stream is a continuous series of data that represents a sound, such as a song.
A channel is a discrete track of monophonic audio. A monophonic stream has one channel; a stereo stream has two channels.
A sample is single numerical value for a single audio channel in an audio stream.
A frame is a collection of time-coincident samples. For instance, a linear PCM stereo sound file has two samples per frame, one for the left channel and one for the right channel.
A packet is a collection of one or more contiguous frames. A packet defines the smallest meaningful set of frames for a given audio data format, and is the smallest data unit for which time can be measured. In linear PCM audio, a packet holds a single frame. In compressed formats, it typically holds more frames. In some formats, the number of frames per packet varies.
The sample rate for a stream is the number of frames per second of uncompressed audio, or, for compressed formats, the equivalent in decompressed audio.
Topics
Inspecting a description
mFormatIDmFormatFlagsmSampleRatemBitsPerChannelmBytesPerFramemChannelsPerFramemBytesPerPacketmFramesPerPacketmReserved