---
title: "init(data:soundBankURL:)"
framework: avfaudio
role: symbol
role_heading: Initializer
path: "avfaudio/avmidiplayer/init(data:soundbankurl:)"
---

# init(data:soundBankURL:)

Creates a player to play MIDI data with the specified soundbank.

## Declaration

```swift
init(data: Data, soundBankURL bankURL: URL?) throws
```

## Parameters

- `data`: The data to play.
- `bankURL`: The URL of the sound bank. The sound bank must be a SoundFont2 or DLS bank. In macOS, you can pass doc://com.apple.documentation/documentation/ObjectiveC/nil-227m0 for the bank URL argument to use the default sound bank. In iOS, you must always pass a valid bank file.

## Return Value

Return Value A new MIDI player, or nil if an error occurred.

## See Also

### Creating a MIDI player

- [init(contentsOf:soundBankURL:)](avfaudio/avmidiplayer/init(contentsof:soundbankurl:).md)
