Class

AVAudioFile

An audio file that can be opened for reading or writing.

Declaration

@interface AVAudioFile : NSObject

Overview

Regardless of the file’s actual format, you read and write it using AVAudioPCMBuffer objects that contain samples using AVAudioCommonFormat. This format is referred to as the file’s processing format. Conversions are performed to and from the file’s actual format.

Reads and writes are always sequential, but random access is possible by setting the framePosition property.

Topics

Creating an Audio File

- initForReading:commonFormat:interleaved:error:

Open a file for reading using a specified processing format.

- initForReading:error:

Opens a file for reading.

- initForWriting:settings:commonFormat:interleaved:error:

Open a file for writing using a specified processing format.

- initForWriting:settings:error:

Open a file for writing.

Reading and Writing the Audio Buffer

- readIntoBuffer:error:

Read an entire buffer.

- readIntoBuffer:frameCount:error:

Read a portion of a buffer.

Getting Audio File Properties

fileFormat

The on-disk format of the file.

processingFormat

The processing format of the file.

framePosition

The position in the file at which the next read or write operation will occur.

AVAudioFramePosition

A position in an audio file or stream.

length

The number of sample frames in the file.

AVAudioFrameCount

A number of audio sample frames.

url

The URL the file is reading or writing.

AVAudioFileTypeKey

A string indicating the audio file type.

Relationships

Inherits From

See Also

First Steps

AVAudioBuffer

A buffer of audio data and its format.

AVAudioTime

A class used by the audio engine to represent time.

Audio Settings and Formats

Define audio data with these constants and classes.

Enabling USB Audio and MIDI for iOS

Set up your system to record digital audio from an iOS device and exchange MIDI data with it by enabling Inter-Device Audio and MIDI.