MIDI

  • MIDI input and output handler

    You add MIDI listeners like this:

    var midi = AudioKit.midi
    midi.openInput()
    midi.addListener(someClass)
    

    …where someClass conforms to the AKMIDIListener protocol

    You then implement the methods you need from AKMIDIListener and use the data how you need.

    See more

    Declaration

    Swift

    open class AKMIDI
  • MIDI Instrument that triggers functions on MIDI note on/off commands This is used mostly with the AppleSequencer sending to a MIDIEndpointRef Another callback instrument, AKCallbackInstrument You will need to enable Background Modes - Audio in your project for this to work.

    See more

    Declaration

    Swift

    open class AKMIDICallbackInstrument : AKMIDIInstrument
  • This class is used to count midi clock events and inform observers every 24 pulses (1 quarter note)

    If you wish to observer its events, then add your own AKMIDIBeatObserver

    See more

    Declaration

    Swift

    open class AKMIDIClockListener : NSObject
  • Common name of MIDI Control number from MIDIByte

    • ModulationWheel: Modulation Control
    • BreathControl: Breath Control (in MIDI Saxophones for example)
    • FootControl: Foot Control
    • Portamento: Portamento effect
    • DataEntry: Data Entry
    • MainVolume: Volume (Overall)
    • Balance
    • Pan: Stereo Panning
    • Expression: Expression Pedal
    • LSB: Least Significant Byte
    • DamperOnOff: Damper Pedal, also known as Hold or Sustain
    • PortamentoOnOff: Portamento Toggle
    • SustenutoOnOff: Sustenuto Toggle
    • SoftPedalOnOff: Soft Pedal Toggle
    • DataEntryPlus: Data Entry Addition
    • DataEntryMinus: Data Entry Subtraction
    • LocalControlOnOff: Enable local control
    • AllNotesOff: MIDI Panic
    • CC# (0, 3, 9, 12-31) Unnamed Continuous Controllers
    See more

    Declaration

    Swift

    public enum AKMIDIControl : MIDIByte
  • A version of AKInstrument specifically targeted to instruments that should be triggerable via MIDI or sequenced with the sequencer.

    See more

    Declaration

    Swift

    open class AKMIDINode : AKNode, AKMIDIListener
  • Struct holding revelant data for AKMusicTrack note events

    See more

    Declaration

    Swift

    public struct AKMIDINoteData : CustomStringConvertible, Equatable
  • Declaration

    Swift

    public struct AKMIDIStatus : AKMIDIMessage
  • Potential MIDI Status messages

    • NoteOff: something resembling a keyboard key release
    • NoteOn: triggered when a new note is created, or a keyboard key press
    • PolyphonicAftertouch: rare MIDI control on controllers in which every key has separate touch sensing
    • ControllerChange: wide range of control types including volume, expression, modulation and a host of unnamed controllers with numbers
    • ProgramChange: messages are associated with changing the basic character of the sound preset
    • ChannelAftertouch: single aftertouch for all notes on a given channel (most common aftertouch type in keyboards)
    • PitchWheel: common keyboard control that allow for a pitch to be bent up or down a given number of semitones
    See more

    Declaration

    Swift

    public enum AKMIDIStatusType : Int
  • MIDI System Command

    • None: Trivial Case
    • Sysex: System Exclusive
    • SongPosition: Song Position
    • SongSelect: Song Selection
    • TuneRequest: Request Tune
    • SysexEnd: End System Exclusive
    • Clock
    • Start
    • Continue
    • Stop
    • ActiveSensing: Active Sensing
    • SysReset: System Reset
    See more

    Declaration

    Swift

    public enum AKMIDISystemCommand : MIDIByte, AKMIDIMessage
  • Declaration

    Swift

    public enum AKMIDISystemCommandType
  • This AKMIDIListener looks for midi system real time (SRT) midi system messages.

    See more

    Declaration

    Swift

    open class AKMIDISystemRealTimeListener : 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.

    See more

    Declaration

    Swift

    open class AKMIDITempoListener : NSObject
  • Allows a MIDIPacket to be iterated through with a for statement. This is necessary because MIDIPacket can contain multiple midi events, but Swift makes this unnecessarily hard because the MIDIPacket struct uses a tuple for the data field. Grrr!

    Example usage: let packet: MIDIPacket for message in packet { // message is a Message }

    See more

    Declaration

    Swift

    extension MIDIPacket: Sequence
  • A button that will pull up a Bluetooth MIDI menu

    See more

    Declaration

    Swift

    public class AKBluetoothMIDIButton : UIButton