---
title: "write(toFile:metadata:)"
framework: createml
role: symbol
role_heading: Instance Method
path: "createml/mlsoundclassifier/write(tofile:metadata:)"
---

# write(toFile:metadata:)

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

## Declaration

```swift
func write(toFile path: String, metadata: MLModelMetadata? = nil) throws
```

## Parameters

- `path`: The location path in the file system where you want to save the model.
- `metadata`: Descriptive information to include with the exported model file.

## Discussion

Discussion Use this method to save the sound classifier as a Core ML model to a path. This method: Uses the name SoundClassifier.mlmodel if the path’s location is a directory Appends mlmodel as the extension if you don’t provide one Replaces the tilde (~) with the path to your home directory Creates intermediate directories if none exist

## See Also

### Saving a sound classifier

- [write(to:metadata:)](createml/mlsoundclassifier/write(to:metadata:).md)
