Class

AVAudioFile

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

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

init(forReading: URL, commonFormat: AVAudioCommonFormat, interleaved: Bool)

Open a file for reading using a specified processing format.

init(forReading: URL)

Opens a file for reading.

Reading and Writing the Audio Buffer

Getting Audio File Properties

var fileFormat: AVAudioFormat

The on-disk format of the file.

var processingFormat: AVAudioFormat

The processing format of the file.

var framePosition: AVAudioFramePosition

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

typealias AVAudioFramePosition

A position in an audio file or stream.

var length: AVAudioFramePosition

The number of sample frames in the file.

typealias AVAudioFrameCount

A number of audio sample frames.

var url: URL

The URL the file is reading or writing.

let AVAudioFileTypeKey: String

A string indicating the audio file type.

Relationships

Inherits From

Conforms To

See Also

First Steps

class AVAudioBuffer

This class represents a buffer of audio data and its format.

class AVAudioTime

This class is used by the audio engine to represent time.

Audio Settings and Formats

Constants and classes that define audio data.