<!--
{
  "availability" : [
    "iOS: 15.0.0 -",
    "iPadOS: 15.0.0 -",
    "macCatalyst: 15.0.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CreateML",
  "identifier" : "/documentation/CreateML/MLSoundClassifier/write(to:metadata:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Create ML"
    ],
    "preciseIdentifier" : "s:8CreateML17MLSoundClassifierV5write2to8metadatay10Foundation3URLV_AA15MLModelMetadataVSgtKF"
  },
  "title" : "write(to:metadata:)"
}
-->

# write(to:metadata:)

Exports the sound classifier as a model file to a location in the file system.

```
func write(to fileURL: URL, metadata: MLModelMetadata? = nil) throws
```

## Parameters

`fileURL`

The location URL in the file system where you want to save the model.

`metadata`

Descriptive information to include with the exported model file.

## Discussion

Use this method to save the sound classifier as a Core ML model to a URL.

This method:

- Uses the name `SoundClassifier.mlmodel` if the URL’s location is a directory
- Appends `mlmodel` as the extension if you don’t provide one
- Creates intermediate directories if none exist

---

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)