JacekD
JacekD

Reputation: 21

How to send midi notes triggered by an external midi clock?

I'm working on an arpeggiator app for iOS which is able to send infinite sequence of notes to external MIDI-compatible hardware synthesizers. I'm using AudioKit for receiving and sending MIDI information.

My studio setup includes the E-RM multiclock device which sends a master MIDI clock for a couple of synths and drum machines, so every device can play in sync with others.

I want my iOS app to generate and send MIDI notes to an external synthesizer in sync with other devices that also receive MIDI clock from the Multiclock device. I'm using an iOS compatible audio/MIDI interface so my app can receive the clock and send notes to a hardware synth.

The problem is that after a couple of seconds or minutes of work, notes that my app send start to drift in time. The lag may be either constant (100 - 200ms) or random, making the arpeggiated synth to be out of sync with other machines.

Can this flow be implemented using AudioKit framework properly?

My current implementation uses AKMIDIBeatObserver's receivedQuantum(time:quarterNote:beat:quantum:) function for triggering arpeggiator each time it's supposed to send another eights note.

Notes are sent with AudioKit.midi.sendNoteOnMessage(noteNumber:velocity:channel:) call.

Upvotes: 1

Views: 388

Answers (1)

Kurt Arnlund
Kurt Arnlund

Reputation: 319

You are the first one venturing into this. I can say that AKMIDIBeatObserver, and AudioKit.midi.sendNoteOnMessage would be exactly what I would use. I would also try to not use any logging in there as it might contribute to your experienced lag. It sounds like you are doing everything I would do. If you could share your example project on this I’d look into with you. I don’t know of anything that could contribute to a lag.

Upvotes: 1

Related Questions