Search code examples
iosaudiokitcoremidi

iOS AudioKit using `AKKeyboardView`


The question is very simple. Is it possible to programmatically send a note on/off so it will show on the keyboard view? What I'm trying to do is link the AKMIDICallbackInstrument to the keyboard.

There was an article about doing something similar but it doesn't seem to be possible. (Thinking about it, the keyboard delegate should be the one handling keyboard view touch events, not the other way around...) Also checked the AKKeyboardView code, but it seems like there are only touch related code.

If there is no such method, are there plans to add them?


Solution

  • Two methods have been added to AKKeyboardView on the develop branch of AudioKit:

    programmaticNoteOn(_ note: MIDINoteNumber)
    programmaticNoteOff(_ note: MIDINoteNumber)
    

    These allow you to programmatically simulate key presses and key releases without calling the delegate.