AKSequencer

open class AKSequencer

Sequencer based on tried-and-true CoreAudio/MIDI Sequencing

  • Music sequence

    Declaration

    Swift

    open var sequence: MusicSequence?
  • Pointer to Music Sequence

    Declaration

    Swift

    open var sequencePointer: UnsafeMutablePointer<MusicSequence>?
  • Array of AudioKit Music Tracks

    Declaration

    Swift

    open var tracks = [AKMusicTrack]()
  • Loop control

    Declaration

    Swift

    open var loopEnabled: Bool = false
  • Sequencer Initialization

    Declaration

    Swift

    public init()
  • Initialize the sequence with a MIDI file

    Declaration

    Swift

    public convenience init(filename: String)

    Parameters

    filename

    Location of the MIDI File

  • Preroll for the music player

    Declaration

    Swift

    open func preroll()
  • Set loop functionality of entire sequence

    Declaration

    Swift

    open func toggleLoop()
  • Enable looping for all tracks - loops entire sequence

    Declaration

    Swift

    open func enableLooping()
  • Enable looping for all tracks with specified length

    Declaration

    Swift

    open func enableLooping(_ loopLength: AKDuration)

    Parameters

    loopLength

    Loop length in beats

  • Disable looping for all tracks

    Declaration

    Swift

    open func disableLooping()
  • Set looping duration and count for all tracks

    Declaration

    Swift

    open func setLoopInfo(_ duration: AKDuration, numberOfLoops: Int)

    Parameters

    duration

    Duration of the loop in beats

    numberOfLoops

    The number of time to repeat

  • Set length of all tracks

    Declaration

    Swift

    open func setLength(_ length: AKDuration)

    Parameters

    length

    Length of tracks in beats

  • Length of longest track in the sequence

    Declaration

    Swift

    open var length: AKDuration
  • Set the rate of the sequencer

    Declaration

    Swift

    open func setRate(_ rate: Double)

    Parameters

    rate

    Set the rate relative to the tempo of the track

  • Rate relative to the default tempo (BPM) of the track

    Declaration

    Swift

    open var rate: Double
  • Set the tempo of the sequencer

    Declaration

    Swift

    open func setTempo(_ bpm: Double)
  • Add a tempo change to the score

    Declaration

    Swift

    open func addTempoEventAt(tempo bpm: Double, position: AKDuration)

    Parameters

    bpm

    Tempo in beats per minute

    position

    Point in time in beats

  • Tempo retrieved from the sequencer

    Declaration

    Swift

    open var tempo: Double
  • Convert seconds into AKDuration

    Declaration

    Swift

    open func duration(seconds: Double) -> AKDuration

    Parameters

    seconds

    time in seconds

  • Convert beats into seconds

    Declaration

    Swift

    open func seconds(duration: AKDuration) -> Double

    Parameters

    duration

    AKDuration

  • Play the sequence

    Declaration

    Swift

    open func play()
  • Stop the sequence

    Declaration

    Swift

    @objc open func stop()
  • Rewind the sequence

    Declaration

    Swift

    open func rewind()
  • Wheter or not the sequencer is currently playing

    Declaration

    Swift

    open var isPlaying: Bool
  • Current Time

    Declaration

    Swift

    open var currentPosition: AKDuration
  • Current Time relative to sequencer length

    Declaration

    Swift

    open var currentRelativePosition: AKDuration
  • Track count

    Declaration

    Swift

    open var trackCount: Int
  • Load a MIDI file

    Declaration

    Swift

    open func loadMIDIFile(_ filename: String)
  • Get a new track

    Declaration

    Swift

    open func newTrack(_ name: String = "Unnamed") -> AKMusicTrack?
  • Declaration

    Swift

    open func clearRange(start: AKDuration, duration: AKDuration)

    Parameters

    start

    Starting position of clearing

    duration

    Length of time after the start position to clear

  • Set the music player time directly

    Declaration

    Swift

    open func setTime(_ time: MusicTimeStamp)

    Parameters

    time

    Music time stamp to set

  • Generate NSData from the sequence

    Declaration

    Swift

    open func genData() -> Data?
  • Print sequence to console

    Declaration

    Swift

    open func debug()
  • Set the midi output for all tracks

    Declaration

    Swift

    open func setGlobalMIDIOutput(_ midiEndpoint: MIDIEndpointRef)
  • Nearest time of quantized beat

    Declaration

    Swift

    open func nearestQuantizedPosition(quantizationInBeats: Double) -> AKDuration
  • The last quantized beat

    Declaration

    Swift

    open func previousQuantizedPosition(quantizationInBeats: Double) -> AKDuration
  • Next quantized beat

    Declaration

    Swift

    open func nextQuantizedPosition(quantizationInBeats: Double) -> AKDuration