ios – How do I measure the duration of a MIDI note input with AudioKit
I’m experimenting with an iOS app to record in real time from a MIDI keyboard using AudioKit (v5.6.1). Using the receivedMIDINoteOn() and receivedMIDINoteOff() MIDIListener delegate methods I receive the note number, velocity, channel and timestamp. I want to calculate the duration of the note in milliseconds so that I can compute the note value based on the current tempo setting. Is it possible to calculate this using the timestamps?
As an experiment I played a single note for approximately 10 seconds (+/- 200ms) and got the following timestamp values: note on: 115071237234, note off: 115315013613, a difference of 243776379. The documentation does not provide any information about the interpretation of these values. After extensive internet searching I have been unable to find any discusion of this subject.
Would it make more sense to use a Stopwatch instance and compute time deltas using elapsed time of event receipt?
Read more here: Source link
