我已经从源代码为macOS Xcode 10.2构建了库,但我无法让MIDI工作。 MIDI输入似乎很好

问题描述 投票:1回答:1

我正在学习AudioKit框架,因为4.2二进制文件与Xcode 10.2中的5.0编译器不兼容,所以有必要从源代码构建框架。我无法将MIDI输出工作到物理设备或使用虚拟端口到另一个应用程序。

我无法让MIDI输出操场的示例工作。我没有错误但也没有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()
audiokit
1个回答
1
投票

我想到了。事实证明,AudioKit实际上是在频道4而不是频道3上发送。看起来频道索引是1。 根据开发人员,MIDI通道的索引是0,而不是1,因此这是预期的行为

© www.soinside.com 2019 - 2024. All rights reserved.