Music is a form of entertainment that is mediated through sound. I believe the experience of music can be extended to other senses beyond hearing. In particular, applying graphical visualization to music can make it more vivid, memorable, and enjoyable.
MidVis is a tool that aids in identifying properties of music. It differs from classic "ambient" visualizations in that everything you see encodes information about the music. Notes and their respective velocities and instruments are viewed through color, shape, and speed.
This program contains an implementation of the open-source midi player, TiMidity. Modifications were required to transform TiMidity into library form, and extract the relevant midi data while a sample is playing. When a midi file is opened, TiMidity is invoked on a separate FLTK thread (pthread). This measure is necessary to run a visualization simultaneously, as TiMidity enters a loop for the duration of the song. TiMidity raises events to the main application to signal Note-On and Note-Off events. Since TiMidity preprocesses a midi file immediately, all events are added to a queue where they will be handled once their sample timestamp has arrived. The render loop is run on the other thread, which maintains the midi time. For every frame of the animation, the event queue is tested. When a note is turned on, a GL_QUAD glyph is activated and added to the bottom of the screen. The X position of this glyph is determined by an interpolation of the note across the range of notes for the given instrument channel. When a note is turned off, the GL_QUAD glyph is deactivated. Deactive notes are moved up the screen at a rate of "speed" pixels per frame. Active notes are only "stretched". Additionally, a "fading" effect is applied, such that the alpha value of each note is decreased by "fade" alpha/frame.
MidVis was developed on the Windows platform using MinGW and MSYS. It uses FLTK, OpenGL, and TiMidity++. Each of these components is cross-platform, so it is conceivable that MidVis may be built for other platforms such as Linux. Doing so would undoubtedly require that the Makefile be edited, and the correct libraries be included. This process is not within the scope of my documentation.
To run MidVis, download the Binary above. midvis.exe and timidity.cfg are needed to run. Also you will need to download EAWPats and save them in a local folder "eawpats". You may optionally use a different set of instrument patches if you are familiar with TiMidity customization.
Writing music applications is more difficult than I anticipated. 90% of my effort on this project was dedicated to retreiving relevant information from midi files. This implies working with TiMidity. TiMidity was a hassle, but in the end it proved to be powerful. TiMidity was written in C, and this program in C++. I struggled for a while trying to get all of the components to link together. Also, TiMidity is its own program which has its own main loop. This required the design of a multithreaded application. With which, I ran into some synchronization issues along the way which set me back a while. The sum of these and other little nuisances resulted in a large inconvenience that could have been avoided if I chose another subject. However, I feel that this aspect of software engineering was a useful experience. Like I say, the other 10% was merely coding the visualization. While it was not as impressive as I hoped, I still got the job done in a functional way. I guess you can call it the Minimal Midi Visualizer.