Sampler Demo


This demo is based off of the work by Jeff Cooper.

Before reading this, we highly recommend you to read a great tutorial on Hello World example first. This example is included in AudioKit in the Examples directory with versions for iOS and OSX.

Our sampler uses recordings of sounds that were preloaded into Sounds directory of the project folder.

Again, like we did in Sequencer Demo we create an instance of an Conductor():

    let conductor = Conductor()

And then we jump right into Conductor.swift file where we can find the same declarations for a basic sequencer, a mixing node, a filter node, a playback node to generate audio, and a mixing node.

    var sequence: AKSequencer?
    var mixer = AKMixer()
    var filter: AKMoogLadder?
    var arpeggioSynthesizer = AKSampler()
    var arpeggioVolume: AKBooster?

During the init() function we initialize the instruments, connect them to a mixing node, create a filter node from a mixing one, and then start the AudioKit engine.

    arpeggioVolume = AKBooster(arpeggioSynthesizer)
    filter = AKMoogLadder(mixer)
    AudioKit.output = filter
    arpeggioSynthesizer.loadEXS24("Sounds/Sampler Instruments/sqrTone1")
    sequence = AKSequencer(filename: "seqDemo", engine: AudioKit.engine)
    sequence!.avTracks[1].destinationAudioUnit = arpeggioSynthesizer.samplerUnit

Featured Video