---
title: "init(data:)"
framework: appkit
role: symbol
role_heading: Initializer
path: "appkit/nssound/init(data:)"
---

# init(data:)

Initializes the receiver with a given audio data.

## Declaration

```swift
init?(data: Data)
```

## Parameters

- `data`: Audio data with which the receiver is to be initialized. The data must have a proper magic number, sound header, and data for the formats the NSSound class supports.

## Return Value

Return Value Initialized NSSound instance.

## See Also

### Creating Sounds

- [canInit(with:)](appkit/nssound/caninit(with:).md)
- [init(contentsOfFile:byReference:)](appkit/nssound/init(contentsoffile:byreference:).md)
- [init(contentsOf:byReference:)](appkit/nssound/init(contentsof:byreference:).md)
- [init(pasteboard:)](appkit/nssound/init(pasteboard:).md)
