---
title: "ExtAudioFileWriteAsync(_:_:_:)"
framework: audiotoolbox
role: symbol
role_heading: Function
path: "audiotoolbox/extaudiofilewriteasync(_:_:_:)"
---

# ExtAudioFileWriteAsync(_:_:_:)

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

## Declaration

```swift
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

Return Value A result code.

## Discussion

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(_:) function is called. Errors may occur after this call has returned. Such errors may be returned from subsequent calls to this function.

## See Also

### Reading and Writing Audio Data

- [ExtAudioFileRead(_:_:_:)](audiotoolbox/extaudiofileread(_:_:_:).md)
- [ExtAudioFileSeek(_:_:)](audiotoolbox/extaudiofileseek(_:_:).md)
- [ExtAudioFileTell(_:_:)](audiotoolbox/extaudiofiletell(_:_:).md)
- [ExtAudioFileWrite(_:_:_:)](audiotoolbox/extaudiofilewrite(_:_:_:).md)
