I’ve been working on a few MIDI-based programs in Processing recently, a couple of which are MIDI visualisers. These are programs that create a visual display based on the output from a midi file (similar to those seen at: http://www.musanim.com/). The visualiser will use the pitch, velocity and duration of midi notes to create the display. I’ve uploaded a video to youtube, but due to some problems getting videos out of processing, the quality is rather low – I hope you can discern what’s going on (edit: I’ve invested in fraps and improved the video).
So what have I used the MIDI pitch and velocity for?
Firstly, I’ve used colour to highlight harmonic relationships between notes (those unfamiliar with music theory may want to skip this bit). I’ve worked on the principle that the perfect 5th is the most consonant interval, and assigned colours to notes being played based on the relationships in the diagram below.
So, we can see that the notes most consonant with C are F and G, which will have the most similar colours. Also, the least consonant interval (i.e. a tritone, or the “devil’s interval”) between C and F# also has the most jarring colour difference.
The velocity of each midi note was then assigned to the speed at which the arcs move, as well as the transparency of each arc (i.e. quiet notes are slow and barely visible, and loud notes are fast and bright) .The final length of each arc is decided by a mix of how loudly a note was played combined with how long it was held on for.
Practically, I used a piece of DAW software to play the midi file, and routed this through the excellent midi yoke (http://www.midiox.com/) to a processing sketch using the rwmidi library (http://ruinwesen.com/support-files/rwmidi/documentation/RWMidi.html). I’ve used the processing video library to capture frames, but as mentioned, there are some significant problems if you wish to sync this output with an audio file (especially if your processing sketch is even remotely complex). I’m looking into using some screen capture software instead, such as fraps.
If you’re interested in this sort of thing, feel free to contact me for the original processing sketch – the video doesn’t really do it justice.
Edit: I’ve included a new midi visualisation below.