Platforms to show: All Mac Windows Linux Cross-Platform

Back to AVAudioFileMBS class.

AVAudioFileMBS.Constructor(File as FolderItem, commonFormat as Integer, Interleaved as Boolean, byref error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundationNode MBS AVFoundation Plugin 15.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Open a file for reading using a specified processing format.

file: 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.
Error: Returns, by-reference, a description of the error, if an error occurs.

Returns an initialized audio file object for reading.

The file format me be is deinterleaved float, that is AVAudioPCMFormatFloat32. 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:

AVAudioFileMBS.Constructor(File as FolderItem, settings as Dictionary, byref error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundationNode MBS AVFoundation Plugin 15.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Open a file for writing.

file: 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.)
Error: Returns, by-reference, a description of the error, if an error occurs.

Returns an initialized audio file object for writing.

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, AVAudioPCMFormatFloat32.

See also:

AVAudioFileMBS.Constructor(File as FolderItem, settings as Dictionary, commonFormat as Integer, Interleaved as Boolean, byref error as NSErrorMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundationNode MBS AVFoundation Plugin 15.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Open a file for writing using a specified processing format.

file: The path to write the file.
settings: The format of the file to create.
format: The processing format to use when writing to the file.
interleaved: Whether to use an interleaved processing format.
Error: Returns, by-reference, a description of the error, if an error occurs.

Returns an initialized audio file object for writing.

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

See also:

AVAudioFileMBS.readIntoBuffer(buffer as AVAudioPCMBufferMBS, byref error as NSErrorMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundationNode MBS AVFoundation Plugin 15.3 ✅ Yes ❌ No ❌ No ✅ Yes All
The buffer from which to read into the file.

buffer: The buffer from which to read the file. Its format must match the file’s processing format.
Error: Returns, by-reference, a description of the error, if an error occurs.

Returns true, if the read was successful; otherwise false.

Reading sequentially from the framePosition property, attempts to fill the buffer to its capacity. On return, the buffer’s length property indicates the number of sample frames successfully read.

See also:

Some examples using this method:

AVAudioFileMBS.readIntoBuffer(buffer as AVAudioPCMBufferMBS, frameCount as Integer, byref error as NSErrorMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundationNode MBS AVFoundation Plugin 15.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Read a portion of a buffer.

buffer: The buffer from which to read the file. Its format must match the file’s processing format.
frames: The number of frames to read.
Error: Returns, by-reference, a description of the error, if an error occurs.

Returns true, if the read was successful; otherwise false.

Like the read method, but can be used to read fewer frames than the buffer frameCapacity.

See also:

AVAudioFileMBS.writeFromBuffer(buffer as AVAudioPCMBufferMBS, byref error as NSErrorMBS) as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundationNode MBS AVFoundation Plugin 15.3 ✅ Yes ❌ No ❌ No ✅ Yes All
Write a buffer.

buffer: The buffer from which to write to the file. Its format must match the file’s processing format.
Error: Returns, by-reference, a description of the error, if an error occurs.

Returns true, if the read was successful.

Writes sequentially. The buffer's frameLength signifies how much of the buffer is to be written.

Some examples using this method:

The items on this page are in the following plugins: MBS AVFoundation Plugin.


The biggest plugin in space...