AKMIDITempoListener

open class AKMIDITempoListener : NSObject

A AudioKit midi listener that looks at midi clock messages and calculates a BPM

Usage:

let tempoListener = AKMIDITempoListener()
AudioKit.midi.addListener(tempoListener)

Make your class a AKMIDITempoObserver and you will recieve callbacks when the BPM changes.

class YOURCLASS: AKMIDITempoObserver {
    func receivedTempoUpdate(bpm: BPMType, label: String) {  ... }
    func midiClockSlaveMode() { ... }
    func midiClockMasterEnabled() { ... }

midiClockSlaveMode() informs client that midi clock messages have been received and the client may not become the clock master. The client must stop all transmission of MIDI clock.

midiClockMasterEnabled() informs client that midi clock messages have not been seen in 1.6 seconds and the client is allowed to become the clock master.

  • Declaration

    Swift

    public var clockListener: AKMIDIClockListener?
  • Declaration

    Swift

    public var srtListener: AKMIDISystemRealTimeListener
  • Declaration

    Swift

    public var tempoString: String
  • Declaration

    Swift

    public var tempo: BPMType
  • Declaration

    Swift

    public var incomingClockActive: Bool
  • Create a BPM Listener

    This object creates a clockListener: AKMIDIClockListener The AKMIDIClockListener is informed every time there is a clock and it in turn informs its AKMIDIBeatObserver’s whenever beat events happen.

    Declaration

    Swift

    @objc
    public init(smoothing: Float64 = 0.8, bpmHistoryLimit: Int = 3)

    Parameters

    smoothing

    [0 - 1] this value controls the tick smoothing and bpm smoothing (currently both are disabled)

    bpmHistoryLimit

    When a bpm is calculated it’s stored in a array which is sized by this number. The values in this array are averaged and that is the BPM result that is returned. If you make this number larger, then BPM will change very slowly. If you make this number small, then BPM will change very quickly.