This is a parser for MIDI written in pure Elm 0.18 and using the elm-combine parser combinator library.
To parse a MIDI string that represents a MIDI file you can use:
midiFileData |> Midi.Parse.normalise |> Midi.Parse.file
This attempts to parse the contents and also translates running status messages to the appropriate underlying channel message (note on, note off, aftertouch etc.).
On the other hand, you may merely need to parse MIDI events (such as note on or note off) that come from a Web MIDI connection. In other words, you are connecting directly to a MIDI device through the browser and need to parse the stream of event messages as the instrument is played. To do this, use:
midiEventData |> Midi.Parse.event
This will attempt to parse an individual event. Note that Web MIDI does not generate running status messages and this method will not attempt to parse them.
The parser is intended to be a fully conformant with the MIDI standard and accepts Type-0, Type-1 and Type-2 files.