<!--
{
  "availability" : [
    "iOS: 8.0.0 -",
    "iPadOS: 8.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVAudioUnitSampler",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVAudioUnitSampler"
  },
  "title" : "AVAudioUnitSampler"
}
-->

# AVAudioUnitSampler

An object that you configure with one or more instrument samples, based on Apple’s Sampler audio unit.

```
class AVAudioUnitSampler
```

## Overview

An `AVAudioUnitSampler` is an [`AVAudioUnit`](/documentation/AVFAudio/AVAudioUnit) for Apple’s Sampler audio unit.

You configure the sampler by loading instruments from different types of files. These include an `aupreset` file, DLS, or SF2 sound bank; an EXS24 instrument; a single audio file; or an array of audio files.

The output of a `AVAudioUnitSampler` is a single stereo bus.

## Topics

### Configuring the Sampler Audio Unit

[`loadInstrument(at:)`](/documentation/AVFAudio/AVAudioUnitSampler/loadInstrument(at:))

Configures the sampler with the specified instrument file.

[`loadAudioFiles(at:)`](/documentation/AVFAudio/AVAudioUnitSampler/loadAudioFiles(at:))

Configures the sampler by loading the specified audio files.

[`loadSoundBankInstrument(at:program:bankMSB:bankLSB:)`](/documentation/AVFAudio/AVAudioUnitSampler/loadSoundBankInstrument(at:program:bankMSB:bankLSB:))

Loads a specific instrument from the specified soundbank.

### Getting and Setting Sampler Values

[`globalTuning`](/documentation/AVFAudio/AVAudioUnitSampler/globalTuning)

An adjustment for the tuning of all the played notes.

[`overallGain`](/documentation/AVFAudio/AVAudioUnitSampler/overallGain)

An adjustment for the gain of all the played notes, in decibels.

[`stereoPan`](/documentation/AVFAudio/AVAudioUnitSampler/stereoPan)

An adjustment for the stereo panning of all the played notes.

[`masterGain`](/documentation/AVFAudio/AVAudioUnitSampler/masterGain)

An adjustment for the gain of all the played notes, in decibels.



---

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)