Initializer

init(forReading:commonFormat:interleaved:)

Open a file for reading using a specified processing format.

Declaration

init(forReading fileURL: URL, commonFormat format: AVAudioCommonFormat, interleaved: Bool) throws

Parameters

fileURL

The path of the file to read.

format

The processing format to use when reading from the file.

interleaved

Whether to use an interleaved processing format.

outError

Returns, by-reference, a description of the error, if an error occurs.

Return Value

An initialized audio file object for reading.

Discussion

The file format me be is deinterleaved float, that is AVAudioCommonFormat.pcmFormatFloat32. The processing format refers to the buffers read from the file. The content is read and converted from the file format to the processing format. The processing format must be at the same sample rate as the actual file contents and must be linear PCM, whether or not the processing buffer is interleaved float is determined by the interleaved parameter.

See Also

Creating an Audio File