---
title: "loadInstrument(at:)"
framework: avfaudio
role: symbol
role_heading: Instance Method
path: "avfaudio/avaudiounitsampler/loadinstrument(at:)"
---

# loadInstrument(at:)

Configures the sampler with the specified instrument file.

## Declaration

```swift
func loadInstrument(at instrumentURL: URL) throws
```

## Parameters

- `instrumentURL`: The URL of the file that contains the instrument.

## Discussion

Discussion The instrument can be one of the following types: Logic or GarageBand EXS24, the sampler’s native aupreset file, or an audio file, such as caf, aiff, wav, or mp3. For a single audio file, the framework loads it into a new default instrument and uses any information in the audio file, such as the root key and key range, for its placement in the instrument.

## See Also

### Configuring the Sampler Audio Unit

- [loadAudioFiles(at:)](avfaudio/avaudiounitsampler/loadaudiofiles(at:).md)
- [loadSoundBankInstrument(at:program:bankMSB:bankLSB:)](avfaudio/avaudiounitsampler/loadsoundbankinstrument(at:program:bankmsb:banklsb:).md)
