Read note from MIDI file using AudioKit

牧云@^-^@ 提交于 2019-12-03 12:54:43

Have you looked at any of the example Audio Kit projects available for download? they are very useful for troubleshooting AK. I actually find the examples better than the documentation (as implementation isn't explained very well).

As for your question you can add a midi listener to an event, there is an example of this code in the Analog Synth X Project available here.

let midi = AKMIDI()
        midi.createVirtualPorts()
        midi.openInput("Session 1")
        midi.addListener(self)

For a more worked bit of code you can refer to this although the code is likely out of date in parts.

Tony, is it that you aren’t receiving any MIDI events, or just the print statements?

I agree with Axemasta’s response about adding AKMidiListener to the class, along with checking out the MIDI code examples that come with AudioKit. This ROM Player example shows how to play external MIDI files with the AKMidiSsmpler node:

https://github.com/AudioKit/ROMPlayer

In order for the print to display, try wrapping it in a DispatchQueue.main.async so that it’s on the main thread. Here’s an AudioKit MIDI implementation question with a code example that I posted here:

AudioKit iOS - receivedMIDINoteOn function

I hope this helps.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!