davidluzgouveia / midi-parser

Simple single-file C# MIDI parser
MIT License
67 stars 4 forks source link

Getting the Note Length? #1

Open shinkuan opened 4 years ago

shinkuan commented 4 years ago

ex:

foreach(var midiEvent in track.MidiEvents)
    {
        if(midiEvent.MidiEventType == MidiEventType.NoteOn)
        {
            var channel = midiEvent.Channel;
            var note = midiEvent.Note;
            var velocity = midiEvent.Velocity;
            var noteLength = midiEvent.Length //--I want a feature like this, indicate the length of the note (noteOff time - noteOn time)
        }
    }
LovelyA72 commented 3 years ago

Yes, please! Note length is very important in midi music. And this is the most convenient C# midi parser on the internet afaik. Please make this happen!

PiOver2 commented 2 years ago

I have implemented this in a derivative work by splitting midiEvents into MidiOnEvents and MidiOffEvents then calculating the difference in the NoteOn and NoteOff time markers

This is a very nice and robust parser, by the way. I am trying to extract my changes so they can be fully isolated from this example.