Sunday, February 22, 2009

Midi (part 2) Scoreview

For fun, I wrote a program that visualizes the contents of Midi files.
The "score view" is just a Tkinter canvas on which lines and ovals are drawn. None of the graphics are bitmaps (except the clefs), which means that there is freedom to quickly zoom in and out. The sharp signs are actually the text "#" drawn at that point. Writing a custom coordinate translation made this code so much easier. When I specify y coordinates, they are given in units where 2 units is the height of between staff lines. So, moving a note up or down just means incrementing or decrementing its position, and only the lowest level of code needs to know about the actual pixel coordinates.

This tool can be a useful way to explore the contents of a midi song. Besides showing the score for a track, it can also get channel information:

Also, one can view all of the midi events in a track, in a human-readable format:

For a lot of information, and to download, visit this page.

If you've been wondering, yes, the eventual goal is to create a midi editor. This project isn't high priority, though.

No comments: