Initializer

init(forWriting:settings:)

Open a file for writing.

Declaration

init(forWriting fileURL: URL, settings: [String : Any]) throws

Parameters

fileURL

The path of the file to create for writing.

settings

The format of the file to create. (See the settings property in the AVAudioRecorder class.)

outError

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

Return Value

An initialized audio file object for writing.

Discussion

The file type to create is inferred from the file extension of fileURL. This method will overwrite a file at the specified URL if a file already exists.

The file is opened for writing using the standard format, AVAudioCommonFormat.pcmFormatFloat32.

See Also

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.