Flash Midi Server 0.1 released + Sonar source code and audio air apps.

The title says it all really. I’ve updated the project page, but I’ll add the info here too incase you’re reading this through an RSS reader.

Flash Midi Server v0.1

Lawrie Cape 2010
Download from the Google Projects Page.


Flash Midi Server is method for sending MIDI data out of Flash. Using an Actionscript 3 class and a Processing application, you can create generative,

dynamic, fun audio tools in Flash.


Mainly just for fun. Flash Midi Server (FMS) started as an experiment to test communication between Processing and Flash. From there it developed into a

class I played around with a lot – seeing what fun things I could use it for.

As FMS is built in Flash, it allows developers to rapidly prototype audio tools, experiment with new input methods and acess to a huge public code base to

build on top of. There’s a huge amount of technical skill and creativity in the Flash scene and hopefully some of it will be applied to creating innovative

new audio apps using FMS.


FMS sends data from Flash to the FMS server – which then sends the data as a Midi signal.

Firstly run the FMS app in the “Server App” folder.
Then run one of the Flash or Air apps. Note – you cannot run .swf files as they do not have the security permissions to access the midi server, unless you

set the permissions here – http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager04.html

You can set which Midi Channel the audio is played through via the drop down on the FMS app.
Windows XP has “Microsoft Midi Mapper” which plays the notes back over the soundcard. Mac OSX has a similar default Midi Playback setting.

To use FMS with other audio apps, you must install virtual midi softward. For example – LoopBe http://nerds.de/en/loopbe1.html
These channels will then show up in the FMS settings drop down.


Place the uk.co.lawriecape.midi folder structure in you classes folder.
You can then check out the .Fla sources in the “Example FLAs” folder.
A basic setup can be seen below –

In flash –

//Import the Flash Midi Server class.
import uk.co.lawriecape.midi.flashMidiServer;
//Create an instance of the class.
var MS: flashMidiServer = new flashMidiServer();
//Add event listeners for the various Server events - (optional)
	MS.addEventListener("FLASH_MIDI_SERVER_ESTABLISHED", connectionEstablishedHandler);
	MS.addEventListener("FLASH_MIDI_SERVER_LOST",        connectionLostHandler);
	MS.addEventListener("FLASH_MIDI_SERVER_NOT_FOUND",   connectionNotFoundHandler);

function connectionEstablishedHandler(e:Event):void{
	trace("Flash midi server connected.");
	trace("You can start sending data now!");

function connectionLostHandler(e:Event):void{
	trace("Flash midi server disconnected.");

function connectionNotFoundHandler(e:Event):void{
	trace("Flash midi server not found, please check the program is running and try again.");


There are quite a few limitations to the current system, which I’ll be trying to address in future releases. These include –
The ability to send CC data on specified CC numbers.
The ability to have audio output on multiple midi channels at once – to controll multiple instruments from a single server instance.
The ability to send multiple notes at once – eg. Chords or simultaneous drum hits.

If you have any suggestions, or make anything using FMS, please get in touch with me.

Lawrie at LawrieCape.co.uk

See also –

Flash Midi Server – Sonar reproduction. from Lawrie Cape on Vimeo.

Download the source code for Sonar from the Google Projects Page.

Flash Midi Server – Processing + Flash + Webcam Instrument from Lawrie Cape on Vimeo.

6 thoughts on “Flash Midi Server 0.1 released + Sonar source code and audio air apps.”

    I’ve been trying to build a faux Monome/Lemur to interface with FL Studio and my touchscreen. This has amazing potential for human interface.
    I got your examples to work by making them projector .exe’s from your original .swf files. (bear with me as i’m new to this) I modified your files to test and i keep getting this error message :
    “1061: Call to a possibly undefined method addEventListener through a reference with static type uk.co.lawriecape.midi:flashMidiServer.”
    I’m not sure where the “classes folder” that i need to drop the “k.co.lawriecape.midi.flashMidiServer” is located.
    Any thoughts? I’d love to collaborate or barter for some help in this. THANKS!

  2. Hi Ryan,
    Glad you found the project, and I hope it helps you with your ideas.
    About the error – sorry, that’s my fault, I hadn’t uploaded the latest version of the class to the Google code page. I’ll email you the latest class (and I’ve uploaded it to the distribution zip on google code too).

    As for where to keep your classes, I just have a folder in My Documents called Flash Classes, then an AS2 and AS3 directory inside there. Then in Flash you select Edit > Preferences > ActionScript > Actionscript 3.0 settings > Then click the + by the source path section and add your directory.

    You can the put any classes you download in that folder and Flash will automatically know where to find them.

    I’d be really interested on seeing how your projects go and helping out where possible. A lemur style interface should be pretty straight forwards, with sliders, knobs and bangs sending CC data.

    A monome style controller would be a little more difficult – a huge limitation of my library is that it currently can only send single notes at a a time. It’s something I’m working on though. If you need something ASAP, it might be worth trying the Flash Midi stuff Daniel has made over at http://www.abumarkub.net

    By the way, have you seen Andre Michelle’s amazing ToneMatrix – http://lab.andre-michelle.com/tonematrix

    It’s a similar idea – but actually generates the audio itself, as opposed to playing samples or sending midi data.

    Let me know if you get things working.

  3. I like your mind! Thank you for doing this.

    If I ever do anything with this (I hope to) I promise to tell you. Amazing potential…

  4. Hi Mayor Pirkle!
    Sounds good – I look forwards to seeing what you make.
    If you’re planning a complicated piece of work, you might want to check out the similar but more fully featured Flash Midi library I mentioned above over at – http://www.abumarkub.net
    If you do use this one though – feel free to get in touch if you have any questions.

Leave a Reply

Your email address will not be published.