Looking for MIDI to CSV code or, but, not really, a utility

I don’t see any functions in the library for converting MIDI to the comma delimited values format, so, was wondering if I could be pointed in the right direction. Actually, I have never seen MIDI in that format, so, an example would be great as well (what it looks like after being converted).

I have searched the net for utilities that do this (and there are a few), but, what I wanted to do, is, actually add that functionality to Blender 3D for creating music animations.

(I need to convert timing and the notes so that Blender can know what frames to write animation blocks too…)

Also, this could be a cool open source project, if there is an interest.

anyways… thanks in advance.

This is probably because it’s not an especially useful format! Are you trying for something human readable? If so, you can very easily make a function which takes a MidiMessage and returns a String describing it. But why do that yourself when there’s already one in the MidiMessage class itself?

If you’re not looking for something human-readable, why not just open and parse the MIDI files in your Blender script (I assume Python) itself? MIDI files are quite easy to open and read. If you need more info about it, you can read the specs on the MIDI website.

hey zac, thanks… Yes, all of this is being done in Python. I was prepared to create a DLL for Blender, if needed, to run the conversion, but, I don’t need to to do that now.

I managed to find a solution since I posted that. I can do everything I need to do, inside of python. (Python org has code)

I also found the structure for the CSV file as well (midi format version)… so, that is a big help too.

This is the code I found so far, and, it’s everything I need to get started…

From Python…

And the code for Blender…

To see the results I am shooting for, you can search YouTube for “AniMusic” and there are several videos. It’s animation generated by music and MIDI.