I had some more time to play around with AudioKit, yet I have a few questions about MIDI. I tried googling and I also checked the AKMIDI class reference, but this just further confused me.
Let's keep it simple: I have a UIButton that should give out a "C" to an external synth.
import AudioKit
midiOut.openOutput()
midiOut.sendEvent(AKMIDIEvent(noteOn: 72, velocity: 80, channel: 1))
sleep(1)
midiOut.sendEvent(AKMIDIEvent(noteOff: 72, velocity: 0, channel: 1))
Obviously this code is spread over the entire ViewController.swift and the sendEvents are inside an @IBAction, but for the sake of keeping it simple, I merged the LOCs.
So my questions are:
Sorry if these questions are ridiculously noobish, but I really am confused by the exact inner workings of this.
Thanks a lot in advance!
You can test your app with simulator as well. Just run your app on simulator and open the Audio MIDI Setup app on your Mac, go to network settings and connect your simulator. Here is a screenshot:
You have full control over AKMIDI
.
* If you want to open all available outputs, just call midi.openOutput()
.
* If you want to open a specific one, like a network session, mostly named "Session 1", call midi.openOutput(name: "Session 1")
.
* You can get all available destinations by midi.destinationNames
string array, if you want to prompt a midi dest picker to user, then just open them with their names.
* For closing them midi.endpoints.removeValue(forKey: "Session 1")
.
* And for virtual outputs, call sequencer.midi.createVirtualOutputPort(name: "App MIDI Out")
which is useful to send MIDI to other apps living in your iOS/Mac.
* Also, you can subscribe to AKMIDIListener
protocol's receivedMIDISetupChange
function to get notified when a MIDI hardware/software available or not to connect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With