我正在学习AudioKit框架,有必要从源代码构建该框架,因为4.2二进制文件与Xcode10.2中的5.0编译器不兼容。我无法让MIDI输出在物理设备上工作,也不能使用虚拟端口连接到另一个应用程序。
我无法让示例MIDI output playground正常工作。我没有得到错误,但也没有MIDI输出,我使用以下命令:
import AudioKitPlaygrounds
import AudioKit
let midi = AudioKit.midi
midi.openOutput()
import AudioKitUI
class LiveView: AKLiveViewController, AKKeyboardDelegate {
var keyboard: AKKeyboardView!
override func viewDidLoad() {
addTitle("MIDI Output")
keyboard = AKKeyboardView(width: 440, height: 100)
keyboard.delegate = self
addView(keyboard)
addView(AKButton(title: "Go Polyphonic") { button in
self.keyboard.polyphonicMode = !self.keyboard.polyphonicMode
if self.keyboard.polyphonicMode {
button.title = "Go Monophonic"
} else {
button.title = "Go Polyphonic"
}
})
}
func noteOn(note: MIDINoteNumber) {
midi.sendEvent(AKMIDIEvent(noteOn: note, velocity: 127, channel: 3))
AKLog("sending note \(note)")
}
func noteOff(note: MIDINoteNumber) {
midi.sendEvent(AKMIDIEvent(noteOff: note, velocity: 0, channel: 3))
}
}
import PlaygroundSupport
PlaygroundPage.current.needsIndefiniteExecution = true
PlaygroundPage.current.liveView = LiveView()发布于 2019-03-30 05:11:13
我想通了。事实证明,AudioKit实际上是在通道4而不是通道3上发送的。看起来通道索引关闭了1。
每个开发者的MIDI通道的索引是从0开始的,而不是1,所以这是预期的行为
https://stackoverflow.com/questions/55406516
复制相似问题