Any C programmers wanna help convert code to convert between MIDI + CSV?
#49
(09-02-2022, 05:01 PM)mnrvovrfc Wrote: I purposely created a MIDI file with four events, of different sizes, pitches and velocities so you could see more easily what is being wrapped into.







I'm sorry I couldn't do anything better than terminal "od" command to show the innards of the MIDI file. One thing to keep in mind is that in the RPP file, right after the "E" the "delta time" is stored in decimal, while everything in the screenshot of "od" output is in hexadecimal. Therefore the "delta time" is lost in the string of events in the listing by "od". The "delta time" is tricky, must be a sequence in which the very last byte of that sequence should be the only one not having the high-bit set, while the other bytes before it must be 128 or greater. The "delta time" determines the length and position of notes which is why things get complicated in a polyphonic or multi-track MIDI file.

The MIDI event is really comprised of four values: the "delta time", the event combined with the MIDI channel, the note pitch and finally the velocity. A MIDI note-on must be matched by a note-off later on in the sequence. It has to have the same lower-nibble for MIDI channel and the same MIDI note pitch so the processor knows which note to close. Usually the "delta time" is set to zero for MIDI note-on but is figured out for the note-off, while the velocity is usually set to zero for MIDI note-off.

Almost forgot to mention the MIDI "event" could be note-on, note-off, continuous controller (CC), pitch bend, aftertouch or system-exclusive. The latter is a whole new realm LOL. For example "90" in hex means MIDI note-on for channel 1, and "BB" means MIDI CC for channel 12.

Yes the DAW pictures are ugly... as I've said, it's an early version of REAPER, and it's on Fedora 36 MATE.  :/

Thanks for breaking it down into such simple terms. Some of that is insanely particular, like the last byte needing to have no high bit, and certain values in decimal and others in hex. Ugly! But I guess what a text translator does is smooth out that nonsense and make it simple & easier to interface with. 

So how do you like Reaper, as a musician?
Reply


Messages In This Thread
RE: Any C programmers wanna help convert code to convert between MIDI + CSV? - by madscijr - 09-03-2022, 01:20 AM



Users browsing this thread: 53 Guest(s)