A class that encapsulates Apple's Sampler Audio Unit.


class AVAudioUnitSampler : AVAudioUnitMIDIInstrument


You can configure the sampler audio unit by loading different types of instruments, such as an .aupreset file, a DLS or SF2 sound bank, an EXS24 instrument, a single audio file, or an array of audio files. The output is a single stereo bus.


Configuring the Sampler Audio Unit

func loadAudioFiles(at: [URL])

Configures the sampler by loading the specified audio files.

func loadInstrument(at: URL)

Configures the sampler with the specified instrument file.

func loadSoundBankInstrument(at: URL, program: UInt8, bankMSB: UInt8, bankLSB: UInt8)

Loads a specific instrument from the specified sound bank.

Getting and Setting Sampler Values

var globalTuning: Float

Adjustment for the tuning of all the notes played.

var masterGain: Float

Adjustment for the gain, in decibels, of all the notes played.

var stereoPan: Float

Adjustment for the stereo panning of all the notes played.


Conforms To

See Also

Source Node Types

class AVAudioInputNode

A node that connects to the system's audio input.

class AVAudioIONode

The base class for nodes that connect to the system's audio input or output.

typealias AVAudioIONodeInputBlock

A block to get input data when called by a render operation in the manual rendering mode.

typealias AVAudioNodeCompletionHandler

A general callback handler.

typealias AVAudioPlayerNodeCompletionHandler

The callback handler for buffer or file completion.

class AVAudioPlayerNode

A class that plays buffers or segments of audio files.

class AVAudioUnitGenerator

An audio unit subclass that generates audio output.

class AVAudioUnitMIDIInstrument

An abstract class representing music devices or remote instruments.

class AVAudioSequencer

A collection of MIDI events organized into multiple music tracks, plus a player to play back the events.