Class

AVAudioFormat

A class that represents a buffer of audio data with a format.

Declaration

@interface AVAudioFormat : NSObject

Overview

Instances of this class are immutable.

This class wraps a Core Audio AudioStreamBasicDescription structure, with convenience initializers and accessors for common formats, including Core Audio’s standard deinterleaved, 32-bit floating-point format.

Topics

Creating a New Audio Format Representation

- initStandardFormatWithSampleRate:channelLayout:

Initializes a newly allocated audio format instance as a deinterleaved float with the specified sample rate and channel layout.

- initStandardFormatWithSampleRate:channels:

Initializes a newly allocated audio format instance with the specified sample rate and channel count.

- initWithCommonFormat:sampleRate:channels:interleaved:

Initializes a newly allocated audio format instance

- initWithCommonFormat:sampleRate:interleaved:channelLayout:

Initializes a newly allocated audio format instance with the specified auto format, sample rate, interleaved format and channel layout.

- initWithSettings:

Initializes a newly allocated audio format instance using a settings dictionary.

- initWithStreamDescription:

Initializes a newly allocated audio format instance from a stream description.

- initWithStreamDescription:channelLayout:

Initializes a newly allocated audio format instance from a stream description and channel layout.

- initWithCMAudioFormatDescription:

Initializes a newly allocated audio format instance from a Core Media audio format description.

Getting the Audio Stream Description

streamDescription

The audio stream description.

Comparing Instances

- isEqual:

Returns a Boolean value that indicates whether the audio format instance and a given object have identical format settings.

Getting Audio Format Values

channelCount

The number of channels of audio data.

channelLayout

The underlying audio channel layout.

sampleRate

The audio format sampling rate in hertz.

formatDescription

The audio format description as a CMAudioFormatDescriptionRef, for use with Core Media APIs.

Determining the Audio Format

standard

A Boolean value that indicates whether the format is deinterleaved native-endian float.

interleaved

A Boolean value that describes whether the samples are interleaved.

commonFormat

The common format identifier.

settings

The format represented as a dictionary with keys from AVAudioSettings.

magicCookie

An object that contains metadata required by encoders and decoders.

Constants

AVAudioCommonFormat

These constants describe the common audio formats.

Relationships

Inherits From

Conforms To

See Also

Formats

AVAudioChannelLayout

The roles of a set of audio channels.

AVChannelLayoutKey

The corresponding value is an NSData object containing an AudioChannelLayout structure.

Linear PCM Format Settings

Apply audio settings to linear PCM audio formats.

General Audio Format Settings

Audio settings that apply to all audio formats handled by the AVAudioPlayer and AVAudioRecorder classes.