<!--
{
  "availability" : [
    "iOS: 2.1.0 -",
    "iPadOS: 2.1.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.4.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/ExtAudioFileWriteAsync(_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@ExtAudioFileWriteAsync"
  },
  "title" : "ExtAudioFileWriteAsync(_:_:_:)"
}
-->

# ExtAudioFileWriteAsync(_:_:_:)

Perform an asynchronous, sequential write operation on an audio file.

```
func ExtAudioFileWriteAsync(_ inExtAudioFile: ExtAudioFileRef, _ inNumberFrames: UInt32, _ ioData: UnsafePointer<AudioBufferList>?) -> OSStatus
```

## Parameters

`inExtAudioFile`

The extended audio file object that represents the file you want to write to.

`inNumberFrames`

The number of frames to write.

`ioData`

The buffer(s) from which audio data is written to the file.

## Return Value

A result code.

## Discussion

Writes the provided buffer list to an internal ring buffer and notifies an internal thread to perform the write at a later time. The first time this function is called, allocations may be performed. You can call this function with `0` frames and a `NULL` buffer in a non-time-critical context to initialize the asynchronous mechanism. Once initialized, subsequent calls are very efficient and do not take locks. This technique may be used to write to a file from a realtime thread.

Your application must not mix synchronous and asynchronous writes to the same file.

Pending writes are not guaranteed to be flushed to disk until the [`ExtAudioFileDispose(_:)`](/documentation/AudioToolbox/ExtAudioFileDispose(_:)) function is called.

Errors may occur after this call has returned. Such errors may be returned from subsequent calls to this function.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)