midi in flash

AkaiMDP24

Getting Midi into Flash has always been on the todo list and finally this weekend it all came together.

I started by googling different methods, all of which involved setting up some kind of Flash Server and running an application which communicated with MIDI devices, and relaying MIDI messages to flash through a NetConnection.

I came across the work of John Grden and his impressive papervision guitar demo, very cool. John used Red5 as his Flash Server which I’ve come across on many occasions but never had a chance to properly explore. Red5 is an Open Source Flash Server written in Java, they have a load of tutorials and examples to get you started. I personally recommend the Getting started with Red5 Server tutorial which is your first logical step in getting MIDI into flash, and you can make sure that your Red5 server is working and communication with Flash.

So I borrowed my mates USB MIDI keyboard and got cracking. A whole day of trials and tribulations followed due to keyboard driver issues. If you have USB MIDI device and a Logitech webcam installed on the same machine, beware! Finally solved the problem by clearing some values in the registry which always makes me nervous.

Anyhoo, I won’t be regurgitating what John already outlined in his blog entry, instead here is my working source.

You will have to set your own MIDI-IN and MIDI-OUT devices, whpich you should see come up when the application initialises. Once that is done, start hitting those keys and you should see the MIDI data being traced out. Here is helpful link that will explain the MIDI data coming through. Basically the second value in the array is your note which corresponds to the key you just hit and the third value in the array is your velocity, the strength with which you hit that note. All values range from 0-127.

So with all those MIDI messages pouring into my machine I got a bit excited and went out and bought the Akai MPD24 which includes an assortment of slides, rotary knobs and velocity pads, perfect for an external hardware interface into Flash. So far I’ve built a little app that visually represents each one of the MIDI buttons. Looking forward to plugging it into papervision and hopefully getting it going with some music software, so it controls audio and visuals simultaneously.


About this entry