<!--
{
  "availability" : [
    "macOS: 10.2.0 - 10.6.0"
  ],
  "documentType" : "symbol",
  "framework" : "AudioToolbox",
  "identifier" : "/documentation/AudioToolbox/AudioFileCreate",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Audio Toolbox"
    ],
    "preciseIdentifier" : "c:@F@AudioFileCreate"
  },
  "title" : "AudioFileCreate"
}
-->

# AudioFileCreate

```
extern OSStatus AudioFileCreate(const struct FSRef *inParentRef, CFStringRef inFileName, AudioFileTypeID inFileType, const AudioStreamBasicDescription *inFormat, AudioFileFlags inFlags, struct FSRef *outNewFileRef, AudioFileID*outAudioFile);
```

## Parameters

`inParentRef`

A pointer to the directory where the new file should be created.

`inFileName`

The name of the file to be created.

`inFileType`

The type of audio file to create. See [`AudioFileTypeID`](/documentation/AudioToolbox/AudioFileTypeID) for constants that can be used.

`inFormat`

A pointer to the structure that describes the format of the data.

`inFlags`

Relevant flags for creating or opening the file. Currently set to `0`.

`outNewFileRef`

On output, a pointer to the location of the newly created file.

`outAudioFile`

On output, a pointer to the newly created audio file.

## Return Value

A result code. See Result Codes.

## Discussion

This deprecated function uses an `FSRef` type rather than the `CFURLRef` type used by the [`AudioFileCreateWithURL(_:_:_:_:_:)`](/documentation/AudioToolbox/AudioFileCreateWithURL(_:_:_:_:_:)) function.

## See Also

[`func AudioFileCreateWithURL(CFURL, AudioFileTypeID, UnsafePointer<AudioStreamBasicDescription>, AudioFileFlags, UnsafeMutablePointer<AudioFileID?>) -> OSStatus`](/documentation/AudioToolbox/AudioFileCreateWithURL(_:_:_:_:_:))

Creates a new audio file, or initializes an existing file, specified by a URL.



---

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)