0

Implementing midi 'through' over virtual ports for a sequencer on iOS.

This works sweetly for melodies

midi.createVirtualPorts(98536, name: "MyMagicMIDI")

midi.addListener(self)

func receivedMIDINoteOn(noteNumber: MIDINoteNumber, velocity: MIDIVelocity, channel: MIDIChannel) {

    midi.sendNoteOnMessage(noteNumber: noteNumber, velocity: velocity)

}

func receivedMIDINoteOff(noteNumber: MIDINoteNumber, velocity: MIDIVelocity, channel: MIDIChannel) {

    midi.sendNoteOffMessage(noteNumber: noteNumber, velocity: velocity)

}

But play a perfectly simultaneous chord with a chorder app or from another sequencer and I get an audio crunching cpu spike on a 2017 iPad. The cpu usage with single notes (even super fast arpeggios) is 1% or less but I've noticed figures of 44% and 77% in XCode along with the broken up audio and missed midi events (note offs and subsequent notes) when these simultaneous notes hit. Removing the sendNoteOnMessage and just printing noteNumbers to console works effortlessly (as we might imagine with plenty of great 'sequenceable' polyphonic generator AudioKit apps out there). Tested using AudioKit 4.5.5 and 4.6.1.

Darewe
  • 43
  • 4
  • Wouldn’t this be a question for the AudioKit maintainers? – matt Feb 24 '19 at 13:20
  • I would guess that AK confuses multiple messages with the same timestamp. – CL. Feb 24 '19 at 15:57
  • Matt: possibly but it may be that it's not the way to implement through. – Darewe Feb 25 '19 at 09:50
  • CL: Something like that is going on but it may be at a Core Midi level as I've discovered Coremidi thru which is probably the way to go. Will report back if I can implement it... – Darewe Feb 25 '19 at 09:53

0 Answers0