MIDI Visualisations in Processing

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.

Circle of Fifths, with RGB colour wheel

Circle of Fifths, with RGB colour wheel

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.

About these ads

About chrisballprojects

I fill my spare time playing and recording music, and building things to amuse myself.
This entry was posted in MIDI Projects and tagged , , , , , , , . Bookmark the permalink.

2 Responses to MIDI Visualisations in Processing

  1. Luca says:

    Hi!
    It’s a beautiful project!!
    I want to ask you how did you choose the relationship between colours and notes.
    Did you referred to some particular studies?

    • Hi Luca,
      I’m glad to hear you think it’s beautiful. I didn’t refer to any studies – but it may have been done this way before, I haven’t checked! It simply seemed the most logical way to do it – to overlay the two circles, one of colour (RGB) and one of consonance (circle of fifths). I was looking at processing an audio signal for similar effect, but I struggled with aliasing at lower frequencies and haven’t returned to it for a few months. I have some solutions, but they are tricky to implement in processing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s