let midi = MidiData()
if let data = try? Data(contentsOf: URL(fileURLWithPath: file)) {
midi.load(data: data)
for track in midi.noteTracks {
if track.notes.count == 0 {
continue
}
for note in track.notes {
print(converToNoteName(note.pitch),note.timeStamp,note.duration)
}
}
}
For example, I convert my midi in https://tonejs.github.io/Midi/ to this:
But the time is not correct after parsing with MidiParser. Here is the result:
Here is my code:
What could be wrong? Thanks.